protected function MenuPerRoleAccessTest::prepareMenuLinkAndExpectations in Menu Per Role 8
Prepare expectations for more performant testing.
Parameters
string $menuLinkTitle: The menu link title.
array $showMenuRoles: The roles which can see menu link.
array $hideMenuRoles: The roles which can't see menu link.
array $expectationsPerUser: The list of expectations for this menu link. Keyed by user property.
Throws
\Drupal\Core\Entity\EntityStorageException
3 calls to MenuPerRoleAccessTest::prepareMenuLinkAndExpectations()
- MenuPerRoleAccessTest::testAdminBypass in tests/
src/ Functional/ MenuPerRoleAccessTest.php - Check the admin bypass feature in front.
- MenuPerRoleAccessTest::testRoleAccess in tests/
src/ Functional/ MenuPerRoleAccessTest.php - Check if users have access to menu links.
- MenuPerRoleAdminAccessTest::testRoleAccess in tests/
src/ Functional/ MenuPerRoleAdminAccessTest.php - Check if users have access to menu links.
File
- tests/
src/ Functional/ MenuPerRoleAccessTest.php, line 480
Class
- MenuPerRoleAccessTest
- Test access control to menu links.
Namespace
Drupal\Tests\menu_per_role\FunctionalCode
protected function prepareMenuLinkAndExpectations(string $menuLinkTitle, array $showMenuRoles, array $hideMenuRoles, array $expectationsPerUser) : void {
$this
->createOrUpdateMenuLink($menuLinkTitle, $showMenuRoles, $hideMenuRoles);
foreach ($expectationsPerUser as $userProperty => $expectationPerUser) {
$this->expectations[$userProperty][$menuLinkTitle] = $expectationPerUser;
}
}