You are here

public function FixedToContentMappingTest::testGetFixedBlock in Fixed Block Content 8

Tests the get fixed block method.

File

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

Class

FixedToContentMappingTest
Tests the fixed block content mapping handler.

Namespace

Drupal\Tests\fixed_block_content\Kernel

Code

public function testGetFixedBlock() {

  // Try to get a fixed block for a new (not yet saved) block content.
  $this
    ->assertEmpty($this->mappingHandler
    ->getFixedBlock($this->blockContent));

  // Try to get a fixed block for a not linked block content.
  $this->blockContent
    ->save();
  $this
    ->assertEmpty($this->mappingHandler
    ->getFixedBlock($this->blockContent));

  // Try to get a fixed block for a linked block content.
  $linked_block_content = $this->fixedBlock
    ->getBlockContent();
  $this
    ->assertEquals($this->mappingHandler
    ->getFixedBlock($linked_block_content)
    ->id(), $this->fixedBlock
    ->id());
}