/**
* Tests menu functionality using the admin and user interfaces.
*/
public function testMenuAdministration() { // Log in the user.
$this->
drupalLogin($this->adminUser
);
$this->items =
[];
$this->menu =
$this->
addCustomMenu();
$this->
doMenuTests();
$this->
doTestMenuBlock();
$this->
addInvalidMenuLink();
$this->
addCustomMenuCRUD();
// Verify that the menu links rebuild is idempotent and leaves the same
// number of links in the table.
/** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
$menu_link_manager = \Drupal::
service('plugin.manager.menu.link'
);
$before_count =
$menu_link_manager->
countMenuLinks(NULL
);
$menu_link_manager->
rebuild();
$after_count =
$menu_link_manager->
countMenuLinks(NULL
);
$this->
assertSame($before_count,
$after_count, 'MenuLinkManager::rebuild() does not add more links'
);
// Do standard user tests.