public function LocalActionManagerTest::getActionsForRouteProvider in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php \Drupal\Tests\Core\Menu\LocalActionManagerTest::getActionsForRouteProvider()
File
- core/
tests/ Drupal/ Tests/ Core/ Menu/ LocalActionManagerTest.php, line 185 - Contains \Drupal\Tests\Core\Menu\LocalActionManagerTest.
Class
- LocalActionManagerTest
- @coversDefaultClass \Drupal\Core\Menu\LocalActionManager @group Menu
Namespace
Drupal\Tests\Core\MenuCode
public function getActionsForRouteProvider() {
// Single available and single expected plugins.
$data[] = array(
'test_route',
array(
'plugin_id_1' => array(
'appears_on' => array(
'test_route',
),
'route_name' => 'test_route_2',
'title' => 'Plugin ID 1',
'weight' => 0,
),
),
array(
'plugin_id_1' => array(
'#theme' => 'menu_local_action',
'#link' => array(
'title' => 'Plugin ID 1',
'url' => Url::fromRoute('test_route_2'),
'localized_options' => '',
),
'#access' => AccessResult::forbidden(),
'#weight' => 0,
),
),
);
// Multiple available and single expected plugins.
$data[] = array(
'test_route',
array(
'plugin_id_1' => array(
'appears_on' => array(
'test_route',
),
'route_name' => 'test_route_2',
'title' => 'Plugin ID 1',
'weight' => 0,
),
'plugin_id_2' => array(
'appears_on' => array(
'test_route2',
),
'route_name' => 'test_route_3',
'title' => 'Plugin ID 2',
'weight' => 0,
),
),
array(
'plugin_id_1' => array(
'#theme' => 'menu_local_action',
'#link' => array(
'title' => 'Plugin ID 1',
'url' => Url::fromRoute('test_route_2'),
'localized_options' => '',
),
'#access' => AccessResult::forbidden(),
'#weight' => 0,
),
),
);
// Multiple available and multiple expected plugins and specified weight.
$data[] = array(
'test_route',
array(
'plugin_id_1' => array(
'appears_on' => array(
'test_route',
),
'route_name' => 'test_route_2',
'title' => 'Plugin ID 1',
'weight' => 1,
),
'plugin_id_2' => array(
'appears_on' => array(
'test_route',
),
'route_name' => 'test_route_3',
'title' => 'Plugin ID 2',
'weight' => 0,
),
),
array(
'plugin_id_1' => array(
'#theme' => 'menu_local_action',
'#link' => array(
'title' => 'Plugin ID 1',
'url' => Url::fromRoute('test_route_2'),
'localized_options' => '',
),
'#access' => AccessResult::forbidden(),
'#weight' => 1,
),
'plugin_id_2' => array(
'#theme' => 'menu_local_action',
'#link' => array(
'title' => 'Plugin ID 2',
'url' => Url::fromRoute('test_route_3'),
'localized_options' => '',
),
'#access' => AccessResult::forbidden(),
'#weight' => 0,
),
),
);
// Two plugins with the same route name but different route parameters.
$data[] = array(
'test_route',
array(
'plugin_id_1' => array(
'appears_on' => array(
'test_route',
),
'route_name' => 'test_route_2',
'route_parameters' => array(
'test1',
),
'title' => 'Plugin ID 1',
'weight' => 1,
),
'plugin_id_2' => array(
'appears_on' => array(
'test_route',
),
'route_name' => 'test_route_2',
'route_parameters' => array(
'test2',
),
'title' => 'Plugin ID 2',
'weight' => 0,
),
),
array(
'plugin_id_1' => array(
'#theme' => 'menu_local_action',
'#link' => array(
'title' => 'Plugin ID 1',
'url' => Url::fromRoute('test_route_2', [
'test1',
]),
'localized_options' => '',
),
'#access' => AccessResult::forbidden(),
'#weight' => 1,
),
'plugin_id_2' => array(
'#theme' => 'menu_local_action',
'#link' => array(
'title' => 'Plugin ID 2',
'url' => Url::fromRoute('test_route_2', [
'test2',
]),
'localized_options' => '',
),
'#access' => AccessResult::forbidden(),
'#weight' => 0,
),
),
);
return $data;
}