You are here

public function FixedToContentMappingTest::testSetBlockContentInProtected in Fixed Block Content 8

Tests the set block content method in protected fixed blocks.

File

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

Class

FixedToContentMappingTest
Tests the fixed block content mapping handler.

Namespace

Drupal\Tests\fixed_block_content\Kernel

Code

public function testSetBlockContentInProtected() {

  // Enable the protected mode.
  $this->fixedBlock
    ->setProtected();

  // Get the block content. This will create a new block content.
  $block_content_id = $this->fixedBlock
    ->getBlockContent()
    ->id();

  // Replace existing block with a new one.
  $this->mappingHandler
    ->setBlockContent($this->fixedBlock, $this->blockContent);

  // The previous block content must has been deleted.
  $this
    ->assertEmpty($this->entityTypeManager
    ->getStorage('block_content')
    ->load($block_content_id));
}