function EntityMaskTest::testSave

Same name in other branches
  1. 8.x-3.x modules/ctools_entity_mask/tests/src/Kernel/EntityMaskTest.php \Drupal\Tests\ctools_entity_mask\Kernel\EntityMaskTest::testSave()

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);
}