public function PathPluginBaseTest::testCollectRoutesWithSpecialRouteName in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\display\PathPluginBaseTest::testCollectRoutesWithSpecialRouteName()
- 9 core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\display\PathPluginBaseTest::testCollectRoutesWithSpecialRouteName()
Tests the collect routes method with an alternative route name in the UI.
File
- core/
modules/ views/ tests/ src/ Unit/ Plugin/ display/ PathPluginBaseTest.php, line 203 - Contains \Drupal\Tests\views\Unit\Plugin\display\PathPluginBaseTest.
Class
- PathPluginBaseTest
- @coversDefaultClass \Drupal\views\Plugin\views\display\PathPluginBase @group views
Namespace
Drupal\Tests\views\Unit\Plugin\displayCode
public function testCollectRoutesWithSpecialRouteName() {
[
$view,
] = $this
->setupViewExecutableAccessPlugin();
$display = [];
$display['display_plugin'] = 'page';
$display['id'] = 'page_1';
$display['display_options'] = [
'path' => 'test_route',
'route_name' => 'test_route',
];
$this->pathPlugin
->initDisplay($view, $display);
$collection = new RouteCollection();
$result = $this->pathPlugin
->collectRoutes($collection);
$this
->assertEquals([
'test_id.page_1' => 'test_route',
], $result);
$route = $collection
->get('test_route');
$this
->assertInstanceOf(Route::class, $route);
$this
->assertEquals('test_id', $route
->getDefault('view_id'));
$this
->assertEquals('page_1', $route
->getDefault('display_id'));
$this
->assertEquals('Drupal\\views\\Routing\\ViewPageController::getTitle', $route
->getDefault('_title_callback'));
}