function LocalTaskDefaultTest::testGetOptions

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php \Drupal\Tests\Core\Menu\LocalTaskDefaultTest::testGetOptions()
  2. 10 core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php \Drupal\Tests\Core\Menu\LocalTaskDefaultTest::testGetOptions()
  3. 11.x core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php \Drupal\Tests\Core\Menu\LocalTaskDefaultTest::testGetOptions()

@covers ::getOptions

File

core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php, line 303

Class

LocalTaskDefaultTest
@coversDefaultClass \Drupal\Core\Menu\LocalTaskDefault @group Menu

Namespace

Drupal\Tests\Core\Menu

Code

public function testGetOptions() {
    $this->pluginDefinition['options'] = [
        'attributes' => [
            'class' => [
                'example',
            ],
        ],
    ];
    $this->setupLocalTaskDefault();
    $route_match = new RouteMatch('', new Route('/'));
    $this->assertEquals($this->pluginDefinition['options'], $this->localTaskBase
        ->getOptions($route_match));
    $this->localTaskBase
        ->setActive(TRUE);
    $this->assertEquals([
        'attributes' => [
            'class' => [
                'example',
                'is-active',
            ],
        ],
    ], $this->localTaskBase
        ->getOptions($route_match));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.