You are here

public function PreviewLinkEntityTest::testAddEntity in Preview Link 2.x

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

Tests adding a single entity.

@covers ::addEntity

File

tests/src/Kernel/PreviewLinkEntityTest.php, line 59

Class

PreviewLinkEntityTest
Preview link session test.

Namespace

Drupal\Tests\preview_link\Kernel

Code

public function testAddEntity() : void {
  $previewLink = PreviewLink::create();
  $entity = EntityTestRevPub::create();
  $this
    ->assertCount(0, $previewLink->entities
    ->referencedEntities());
  $previewLink
    ->addEntity($entity);
  $this
    ->assertCount(1, $previewLink->entities
    ->referencedEntities());
}