You are here

public function FixedToContentMappingTest::testGetDeletedBlockContent in Fixed Block Content 8

Tests that a new custom block is created if the existing was deleted.

File

tests/src/Kernel/FixedToContentMappingTest.php, line 81

Class

FixedToContentMappingTest
Tests the fixed block content mapping handler.

Namespace

Drupal\Tests\fixed_block_content\Kernel

Code

public function testGetDeletedBlockContent() {

  // Get the block content, it will be created.
  $block_content = $this->fixedBlock
    ->getBlockContent();

  // Preserve ID.
  $original_id = $block_content
    ->id();

  // Delete it.
  $block_content
    ->delete();

  // Get again the block content, a new one must be created.
  $block_content = $this->fixedBlock
    ->getBlockContent();
  $this
    ->assertNotEquals($block_content
    ->id(), $original_id);
}