protected function MenuAdminPerMenuAccessTest::setUp in Menu Admin per Menu 8
Overrides KernelTestBase::setUp
File
- tests/
src/ Kernel/ MenuAdminPerMenuAccessTest.php, line 152
Class
- MenuAdminPerMenuAccessTest
- Class MenuAdminPerMenuAccessTest.
Namespace
Drupal\Tests\menu_admin_per_menu\KernelCode
protected function setUp() : void {
parent::setUp();
$this
->installEntitySchema('menu');
$this
->installEntitySchema('menu_link_content');
$this
->installSchema('system', 'sequences');
$this
->installConfig('system');
$this
->installEntitySchema('user');
$this
->installConfig('user');
$this
->installConfig('menu_admin_per_menu_test');
$this->menuAdminPerMenuAllowedMenus = $this->container
->get('menu_admin_per_menu.allowed_menus');
$this->menuLinkContentStorage = $this->container
->get('entity_type.manager')
->getStorage('menu_link_content');
$this->menuLinkManager = $this->container
->get('plugin.manager.menu.link');
$this->menuStorage = $this->container
->get('entity_type.manager')
->getStorage('menu');
$this->menu1 = $this->menuStorage
->load('menu_1');
$this->menu2 = $this->menuStorage
->load('menu_2');
$this->menu3 = $this->menuStorage
->load('menu_3');
$this->anonymousUser = new AnonymousUserSession();
// The admin user is created as first user, so this user has ID 1.
$this->adminUser = $this
->createUser([], 'Admin', TRUE);
$this->authenticatedUser = $this
->createUser([], 'Authenticated user');
$this->adminMenuUser = $this
->createUser([
'administer menu',
], 'Admin menu user');
$this->menu1User = $this
->createUser([
'administer menu_1 menu items',
], 'Menu 1 user');
$this->menu2User = $this
->createUser([
'administer menu_2 menu items',
], 'Menu 2 user');
// Access to menu_3 is added in menu_admin_per_menu_hook_test.
$this->menu3User = $this
->createUser([], 'Menu 3 user');
// Make sure that links provided in menu_admin_per_menu_test.links.menu.yml
// are picked up.
$this->container
->get('router.builder')
->rebuild();
}