function PathPluginBaseTest::testGetRouteName

Same name in other branches
  1. 8.9.x core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\display\PathPluginBaseTest::testGetRouteName()
  2. 10 core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\display\PathPluginBaseTest::testGetRouteName()
  3. 11.x 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

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.