public function WorkbenchAccessTestTrait::setUpMenuScheme in Workbench Access 8
Sets up a menu scheme for a given node type.
Parameters
array $node_type_ids: Node type.
array $menu_ids: Menu IDs.
string $id: Scheme ID.
Return value
\Drupal\workbench_access\Entity\AccessSchemeInterface Created scheme.
7 calls to WorkbenchAccessTestTrait::setUpMenuScheme()
- AccessByRoleFormTest::testAccessByRoleFormMenu in tests/
src/ Functional/ AccessByRoleFormTest.php - Tests that the correct roles are displayed on the access by role form.
- AccessByUserFormTest::testAccessByUserFormMenu in tests/
src/ Functional/ AccessByUserFormTest.php - Tests that the correct users are displayed on the access by user form.
- AssignUserFormTest::testAssignUserForm in tests/
src/ Functional/ AssignUserFormTest.php - Tests that the AssignUserForm works correctly.
- ConfigDependenciesTest::setUp in tests/
src/ Kernel/ ConfigDependenciesTest.php - DeleteRoleTest::testRoleDelete in tests/
src/ Functional/ DeleteRoleTest.php - Tests that deleting a role clears their data from storage.
File
- tests/
src/ Traits/ WorkbenchAccessTestTrait.php, line 194
Class
- WorkbenchAccessTestTrait
- Contains helper classes for tests to set up various configuration.
Namespace
Drupal\Tests\workbench_access\TraitsCode
public function setUpMenuScheme(array $node_type_ids, array $menu_ids, $id = 'editorial_section') {
$scheme = AccessScheme::create([
'id' => $id,
'label' => ucfirst(str_replace('_', ' ', $id)),
'plural_label' => ucfirst(str_replace('_', ' ', $id)) . 's',
'scheme' => 'menu',
'scheme_settings' => [
'menus' => $menu_ids,
'bundles' => $node_type_ids,
],
]);
$scheme
->save();
return $scheme;
}