You are here

public function PreviewLinkStorageTest::testCreatePreviewLink in Preview Link 8

Same name and namespace in other branches
  1. 2.x tests/src/Kernel/PreviewLinkStorageTest.php \Drupal\Tests\preview_link\Kernel\PreviewLinkStorageTest::testCreatePreviewLink()
  2. 2.0.x tests/src/Kernel/PreviewLinkStorageTest.php \Drupal\Tests\preview_link\Kernel\PreviewLinkStorageTest::testCreatePreviewLink()

Ensure preview link creation works.

File

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

Class

PreviewLinkStorageTest
Preview link form test.

Namespace

Drupal\Tests\preview_link\Kernel

Code

public function testCreatePreviewLink() {
  $preview_link = PreviewLink::create([
    'entity_type_id' => 'node',
    'entity_id' => $this->node
      ->id(),
  ]);
  $this
    ->assertIsString($preview_link
    ->getToken());
  $preview_link = $this->storage
    ->createPreviewLinkForEntity($this->node);
  $this
    ->assertIsString($preview_link
    ->getToken());
  $preview_link = $this->storage
    ->createPreviewLink('node', $this->node
    ->id());
  $this
    ->assertIsString($preview_link
    ->getToken());
}