Tests access check for menu links with a route item.
public function testRouteItemMenuLinksAccess() {
// Add the access checkers to the route items.
$this->container
->get('access_manager')
->setChecks($this
->getTestRouteCollection());
// Setup the links with the route items.
$this->links = array(
new MenuLink(array(
'mlid' => 1,
'route_name' => 'menu_test_1',
'depth' => 1,
'link_path' => 'menu_test/test_1',
), 'menu_link'),
new MenuLink(array(
'mlid' => 2,
'route_name' => 'menu_test_2',
'depth' => 1,
'link_path' => 'menu_test/test_2',
), 'menu_link'),
);
// Build the menu tree and check access for all of the items.
$tree = menu_tree_data($this->links);
menu_tree_check_access($tree);
$this
->assertEqual(count($tree), 1, 'Ensure that just one menu link got access.');
$item = reset($tree);
$this
->assertEqual($this->links[0], $item['link'], 'Ensure that the right link got access');
}