MenuLinkWeightFunctionalTestBase.php in Menu Link Weight 8
File
tests/src/Functional/MenuLinkWeightFunctionalTestBase.php
View source
<?php
namespace Drupal\Tests\menu_link_weight\Functional;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\menu_link_weight\FunctionalJavascript\MenuLinkWeightTestTrait;
abstract class MenuLinkWeightFunctionalTestBase extends BrowserTestBase {
use MenuLinkWeightTestTrait;
public static $modules = [
'menu_link_weight',
'node',
'block',
];
protected $defaultTheme = 'stark';
protected $menuLinkTree;
protected $menuLinkManager;
protected $contentMenuLinkStorage;
protected $moduleInstaller;
protected $state;
protected $nodeType = 'page';
protected function setUp() {
parent::setUp();
$this->menuLinkTree = $this->container
->get('menu.link_tree');
$this->menuLinkManager = $this->container
->get('plugin.manager.menu.link');
$entity_type_manager = $this->container
->get('entity_type.manager');
$this->contentMenuLinkStorage = $entity_type_manager
->getStorage('menu_link_content');
$this->moduleInstaller = $this->container
->get('module_installer');
$this->state = $this->container
->get('state');
$this
->drupalPlaceBlock('system_menu_block:tools');
NodeType::create([
'type' => $this->nodeType,
'name' => $this->nodeType,
'third_party_settings' => [
'menu_ui' => [
'available_menus' => [
'tools',
],
'parent' => 'tools:',
],
],
])
->save();
$permissions = [
'administer menu',
"create {$this->nodeType} content",
"edit own {$this->nodeType} content",
];
$user = $this
->drupalCreateUser($permissions);
$this
->drupalLogin($user);
}
}