'user.logout',
[],
$this->currentUser, TRUE, AccessResult::
allowed()],
]);
$this->
mockTree();
$this->originalTree
[5
]->subtree
[7
]->access = AccessResult::
neutral();
$this->cacheContextManager->
assertValidTokens(['user'
])->
shouldBeCalled()->
willReturn(TRUE
);
$this->originalTree
[8
]->access = AccessResult::
allowed()->
cachePerUser();
// Since \Drupal\Core\Menu\DefaultMenuLinkTreeManipulators::checkAccess()
// allows access to any link if the user has the 'link to any page'
// permission, *every* single access result is varied by permissions.
$tree =
$this->defaultMenuTreeManipulators->
checkAccess($this->originalTree
);
// Menu link 1: route without parameters, access forbidden, but at level 0,
// hence kept.
$element =
$tree[1
];
$this->
assertEquals(AccessResult::
forbidden()->
cachePerPermissions(),
$element->access
);
$this->
assertInstanceOf('\Drupal\Core\Menu\InaccessibleMenuLink',
$element->link
);
// Menu link 2: route with parameters, access granted.
$element =
$tree[2
];
$this->
assertEquals(AccessResult::
allowed()->
cachePerPermissions(),
$element->access
);
$this->
assertNotInstanceOf('\Drupal\Core\Menu\InaccessibleMenuLink',
$element->link
);
// Menu link 3: route with parameters, AccessResult::neutral(), top-level