You are here

public function PathPluginBaseTest::testGetRouteName in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\display\PathPluginBaseTest::testGetRouteName()
  2. 9 core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\display\PathPluginBaseTest::testGetRouteName()

Tests the getRouteName method.

File

core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php, line 525
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\display

Code

public function testGetRouteName() {
  [
    $view,
  ] = $this
    ->setupViewExecutableAccessPlugin();
  $display = [];
  $display['display_plugin'] = 'page';
  $display['id'] = 'page_1';
  $display['display_options'] = [
    'path' => 'test_route',
  ];
  $this->pathPlugin
    ->initDisplay($view, $display);
  $route_name = $this->pathPlugin
    ->getRouteName();

  // Ensure that the expected route name is returned.
  $this
    ->assertEquals('view.test_id.page_1', $route_name);
}