public function PreviewLinkEntityTest::testSetEntities in Preview Link 2.0.x
Same name and namespace in other branches
- 2.x tests/src/Kernel/PreviewLinkEntityTest.php \Drupal\Tests\preview_link\Kernel\PreviewLinkEntityTest::testSetEntities()
Tests setting entities.
@covers ::setEntities
File
- tests/
src/ Kernel/ PreviewLinkEntityTest.php, line 44
Class
- PreviewLinkEntityTest
- Preview link session test.
Namespace
Drupal\Tests\preview_link\KernelCode
public function testSetEntities() : void {
$previewLink = PreviewLink::create();
$entity = EntityTestRevPub::create();
$previewLink
->setEntities([
$entity,
]);
$this
->assertCount(1, $previewLink->entities
->referencedEntities());
$previewLink
->setEntities([
$entity,
]);
// Using setter should override previous values, therefore count is same.
$this
->assertCount(1, $previewLink->entities
->referencedEntities());
}