$this->currentUser,
TRUE,
AccessResult::
neutral(),
],
['example5',
[],
$this->currentUser, TRUE, AccessResult::
allowed()],
['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
);