You are here

protected function SectionCacheTest::setUp in Workbench Access 8

Overrides KernelTestBase::setUp

File

tests/src/Kernel/SectionCacheTest.php, line 65

Class

SectionCacheTest
Tests the internal caching of section data.

Namespace

Drupal\Tests\workbench_access\Kernel

Code

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

  // The user section storage service.
  $this->userSectionStorage = \Drupal::getContainer()
    ->get('workbench_access.user_section_storage');
  $this->scheme = AccessScheme::create([
    'id' => 'editorial_section',
    'label' => 'Editorial section',
    'plural_label' => 'Editorial sections',
    'scheme' => 'taxonomy',
    'scheme_settings' => [
      'vocabularies' => [
        $this->vocabulary
          ->id(),
      ],
      'fields' => [],
    ],
  ]);
  $this->scheme
    ->save();
  $this->userStorage = \Drupal::service('workbench_access.user_section_storage');
}