You are here

protected function WorkspaceTest::setUp in Multiversion 8

Overrides KernelTestBase::setUp

File

tests/src/Kernel/WorkspaceTest.php, line 41

Class

WorkspaceTest
Tests workspace interactions.

Namespace

Drupal\Tests\multiversion\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('workspace');
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('block');
  $this
    ->installEntitySchema('block_content_type');
  $this
    ->installEntitySchema('block_content');
  $this
    ->installEntitySchema('menu_link_content');
  $this
    ->installConfig('multiversion');
  $this
    ->installSchema('key_value', 'key_value_sorted');
  $this
    ->installSchema('system', [
    'sequences',
    'key_value_expire',
  ]);
  $multiversion_manager = $this->container
    ->get('multiversion.manager');
  $multiversion_manager
    ->enableEntityTypes();
  $permissions = [
    'administer workspaces',
  ];
  $this
    ->setCurrentUser($this
    ->createUser($permissions));

  // Create a test workspace type.
  WorkspaceType::create([
    'id' => 'test',
    'label' => 'Test',
  ])
    ->save();

  // Create a live (default) and stage workspace.
  $this->live = Workspace::create([
    'type' => 'test',
    'machine_name' => 'live',
    'label' => 'Live',
  ]);
  $this->live
    ->save();
  $this->stage = Workspace::create([
    'type' => 'test',
    'machine_name' => 'stage',
    'label' => 'Stage',
  ]);
  $this->stage
    ->save();
}