protected function MenuAdminPerMenuMenuPagesTest::setUp in Menu Admin per Menu 8
Overrides BrowserTestBase::setUp
File
- tests/
src/ Functional/ MenuAdminPerMenuMenuPagesTest.php, line 125
Class
- MenuAdminPerMenuMenuPagesTest
- Tests the Menu pages in combination with Menu Admin per Menu.
Namespace
Drupal\Tests\menu_admin_per_menu\FunctionalCode
protected function setUp() : void {
parent::setUp();
$this
->drupalPlaceBlock('page_title_block');
$this
->drupalPlaceBlock('local_actions_block');
ConfigurableLanguage::createFromLangcode('fr')
->save();
// Turn on content translation for menu_link_content.
$config = ContentLanguageSettings::loadByEntityTypeBundle('menu_link_content', 'menu_link_content');
$config
->setDefaultLangcode('en')
->setLanguageAlterable(TRUE)
->setThirdPartySetting('content_translation', 'enabled', TRUE)
->save();
$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->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');
}