You are here

public function DisplayPageTest::testMenuLinks in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Plugin/DisplayPageTest.php \Drupal\views\Tests\Plugin\DisplayPageTest::testMenuLinks()

Tests the generated menu links of views.

File

core/modules/views/src/Tests/Plugin/DisplayPageTest.php, line 133
Contains \Drupal\views\Tests\Plugin\DisplayPageTest.

Class

DisplayPageTest
Tests the page display plugin.

Namespace

Drupal\views\Tests\Plugin

Code

public function testMenuLinks() {
  \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
    ->assertEqual($menu_link
    ->getTitle(), 'Test child (with parent)');
  $this
    ->assertEqual($menu_link
    ->isExpanded(), TRUE);
  $this
    ->assertEqual($menu_link
    ->getDescription(), 'Sample description.');
}