You are here

protected function SectionTokenTest::setUp in Workbench Access 8

Overrides KernelTestBase::setUp

File

tests/src/Kernel/SectionTokenTest.php, line 85

Class

SectionTokenTest
Tests workbench_access integration with tokens.

Namespace

Drupal\Tests\workbench_access\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installConfig([
    'filter',
    'node',
    'workbench_access',
    'system',
  ]);
  $this
    ->installEntitySchema('taxonomy_term');
  $this
    ->installEntitySchema('node');
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('menu_link_content');
  $this
    ->installEntitySchema('section_association');
  $this
    ->installSchema('system', [
    'key_value',
    'sequences',
  ]);
  $this->vocabulary = $this
    ->setUpVocabulary();
  $node_type = $this
    ->setUpContentType();

  // Set a field on the node type.
  $this
    ->setUpTaxonomyFieldForEntityType('node', $node_type
    ->id(), $this->vocabulary
    ->id(), WorkbenchAccessManagerInterface::FIELD_NAME, 'Section', $cardinality = 3);
  $this->taxonomyScheme = $this
    ->setupTaxonomyScheme($node_type, $this->vocabulary);

  // Add a menu to the node type.
  $this->menu = Menu::load('main');
  $node_type
    ->setThirdPartySetting('menu_ui', 'available_menus', [
    'main',
  ]);
  $node_type
    ->save();
  $this->menuScheme = $this
    ->setupMenuScheme([
    $node_type
      ->id(),
  ], [
    'main',
  ], 'menu_section');
  $this->userStorage = \Drupal::service('workbench_access.user_section_storage');
}