You are here

public function LocalTaskManagerTest::testGetLocalTasksForRouteForChild in Drupal 8

Tests the getLocalTasksForRoute method on a child.

See also

\Drupal\system\Plugin\Type\MenuLocalTaskManager::getLocalTasksForRoute()

File

core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php, line 146

Class

LocalTaskManagerTest
@coversDefaultClass \Drupal\Core\Menu\LocalTaskManager @group Menu

Namespace

Drupal\Tests\Core\Menu

Code

public function testGetLocalTasksForRouteForChild() {
  $definitions = $this
    ->getLocalTaskFixtures();
  $this->pluginDiscovery
    ->expects($this
    ->once())
    ->method('getDefinitions')
    ->will($this
    ->returnValue($definitions));
  $mock_plugin = $this
    ->createMock('Drupal\\Core\\Menu\\LocalTaskInterface');
  $this
    ->setupFactory($mock_plugin);
  $this
    ->setupLocalTaskManager();
  $local_tasks = $this->manager
    ->getLocalTasksForRoute('menu_local_task_test_tasks_child1_page');
  $result = $this
    ->getLocalTasksForRouteResult($mock_plugin);
  $this
    ->assertEquals($result, $local_tasks);
}