You are here

protected function NodeMenuTest::setUp in Workbench Access 8

Overrides KernelTestBase::setUp

File

tests/src/Kernel/NodeMenuTest.php, line 74

Class

NodeMenuTest
Tests workbench_access integration with node access via menu plugin.

Namespace

Drupal\Tests\workbench_access\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('node');
  $this
    ->installConfig([
    'filter',
    'node',
    'workbench_access',
    'system',
  ]);
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('menu_link_content');
  $this
    ->installEntitySchema('section_association');
  $this
    ->installSchema('system', [
    'key_value',
    'sequences',
  ]);
  $node_type = $this
    ->createContentType([
    'type' => 'page',
  ]);
  $this
    ->createContentType([
    'type' => 'article',
  ]);

  // This is created by system module.
  $this->menu = Menu::load('main');
  $this->accessHandler = $this->container
    ->get('entity_type.manager')
    ->getAccessControlHandler('node');
  $node_type
    ->setThirdPartySetting('menu_ui', 'available_menus', [
    'main',
  ]);
  $node_type
    ->save();
  $this->scheme = $this
    ->setupMenuScheme([
    $node_type
      ->id(),
  ], [
    'main',
  ]);
  $this->userStorage = \Drupal::service('workbench_access.user_section_storage');
}