function LocalTaskDefaultTest::testGetOptions

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

Tests get options.

@legacy-covers ::getOptions

File

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

Class

LocalTaskDefaultTest
Tests Drupal\Core\Menu\LocalTaskDefault.

Namespace

Drupal\Tests\Core\Menu

Code

public function testGetOptions() : void {
  $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.