You are here

public function WorkspacePointerTest::testCreationWithId in Workspace 8

Verifies pointers can be created using an ID as the reference.

File

tests/src/Kernel/WorkspacePointerTest.php, line 91

Class

WorkspacePointerTest
Tests for the WorkspacePointer entity.

Namespace

Drupal\Tests\workspace\Kernel

Code

public function testCreationWithId() {
  $this
    ->createWorkspaceType();
  $workspace = $this
    ->createWorkspace();

  /** @var WorkspacePointer $pointer */
  $pointer = WorkspacePointer::create();
  $pointer
    ->setWorkspaceId($workspace
    ->id());
  $pointer
    ->save();
  $id = $pointer
    ->id();
  $pointer = WorkspacePointer::load($id);
  $this
    ->assertEquals($workspace
    ->id(), $pointer
    ->getWorkspaceId());
  $this
    ->assertEquals($workspace
    ->id(), $pointer
    ->getWorkspace()
    ->id());
}