protected function LocalTaskIntegrationTestBase::assertLocalTasks in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTestBase.php \Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase::assertLocalTasks()
- 10 core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTestBase.php \Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase::assertLocalTasks()
Tests integration for local tasks.
Parameters
$route_name: Route name to base task building on.
$expected_tasks: A list of tasks groups by level expected at the given route
array $route_params: (optional) A list of route parameters used to resolve tasks.
22 calls to LocalTaskIntegrationTestBase::assertLocalTasks()
- ActionLocalTasksTest::testActionLocalTasks in core/
modules/ action/ tests/ src/ Unit/ Menu/ ActionLocalTasksTest.php - Tests local task existence.
- AggregatorLocalTasksTest::testAggregatorAdminLocalTasks in core/
modules/ aggregator/ tests/ src/ Unit/ Menu/ AggregatorLocalTasksTest.php - Tests local task existence.
- AggregatorLocalTasksTest::testAggregatorSourceLocalTasks in core/
modules/ aggregator/ tests/ src/ Unit/ Menu/ AggregatorLocalTasksTest.php - Checks aggregator source tasks.
- BlockContentLocalTasksTest::testBlockContentListLocalTasks in core/
modules/ block_content/ tests/ src/ Unit/ Menu/ BlockContentLocalTasksTest.php - Checks block_content listing local tasks.
- BlockLocalTasksTest::testBlockAdminDisplay in core/
modules/ block/ tests/ src/ Unit/ Menu/ BlockLocalTasksTest.php - Tests the block admin display local tasks.
File
- core/
tests/ Drupal/ Tests/ Core/ Menu/ LocalTaskIntegrationTestBase.php, line 133
Class
- LocalTaskIntegrationTestBase
- Defines a base unit test for testing existence of local tasks.
Namespace
Drupal\Tests\Core\MenuCode
protected function assertLocalTasks($route_name, $expected_tasks, $route_params = []) {
$directory_list = [];
foreach ($this->directoryList as $key => $value) {
$directory_list[$key] = $this->root . '/' . $value;
}
$manager = $this
->getLocalTaskManager($directory_list, $route_name, $route_params);
$tmp_tasks = $manager
->getLocalTasksForRoute($route_name);
// At this point we're just testing existence so pull out keys and then
// compare.
//
// Deeper testing would require a functioning factory which because we are
// using the DefaultPluginManager base means we get into dependency soup
// because its factories create method and pulling services off the \Drupal
// container.
$tasks = [];
foreach ($tmp_tasks as $level => $level_tasks) {
$tasks[$level] = array_keys($level_tasks);
}
$this
->assertEquals($expected_tasks, $tasks);
}