function DisplayPageTest::testMenuLinks

Same name in other branches
  1. 9 core/modules/views/tests/src/Kernel/Plugin/DisplayPageTest.php \Drupal\Tests\views\Kernel\Plugin\DisplayPageTest::testMenuLinks()
  2. 8.9.x core/modules/views/tests/src/Kernel/Plugin/DisplayPageTest.php \Drupal\Tests\views\Kernel\Plugin\DisplayPageTest::testMenuLinks()
  3. 11.x core/modules/views/tests/src/Kernel/Plugin/DisplayPageTest.php \Drupal\Tests\views\Kernel\Plugin\DisplayPageTest::testMenuLinks()

Tests the generated menu links of views.

File

core/modules/views/tests/src/Kernel/Plugin/DisplayPageTest.php, line 125

Class

DisplayPageTest
Tests the page display plugin.

Namespace

Drupal\Tests\views\Kernel\Plugin

Code

public function testMenuLinks() : void {
    \Drupal::service('plugin.manager.menu.link')->rebuild();
    $tree = \Drupal::menuTree()->load('admin', new MenuTreeParameters());
    $this->assertTrue(isset($tree['system.admin']->subtree['views_view:views.test_page_display_menu.page_4']));
    $menu_link = $tree['system.admin']->subtree['views_view:views.test_page_display_menu.page_4']->link;
    $this->assertEquals('Test child (with parent)', $menu_link->getTitle());
    $this->assertEquals(TRUE, $menu_link->isExpanded());
    $this->assertEquals('Sample description.', $menu_link->getDescription());
}

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