You are here

public function EntityMaskTest::testSave in Chaos Tool Suite (ctools) 8.3

Tests that mask entities have field data after save.

@depends testFields @depends testNoTables

File

modules/ctools_entity_mask/tests/src/Kernel/EntityMaskTest.php, line 219

Class

EntityMaskTest
Basic test of entity type masking.

Namespace

Drupal\Tests\ctools_entity_mask\Kernel

Code

public function testSave() {
  $body = $this
    ->getRandomGenerator()
    ->paragraphs(2);
  $link = 'https://www.drupal.org/project/ctools';

  /** @var \Drupal\Core\Entity\EntityInterface $block */
  $block = BlockContent::create([
    'type' => 'basic',
    'body' => $body,
    'field_link' => $link,
  ]);

  // Ensure that the field values are preserved after save...
  $this
    ->assertSame($body, $block->body->value);
  $this
    ->assertSame($link, $block->field_link->uri);
}