You are here

public function BlockFormAlterTest::testGetBlockContentBundle in Block Style Plugins 8.2

Tests the getBlockContentBundle method.

See also

::getBlockContentBundle()

File

tests/src/Unit/BlockFormAlterTest.php, line 326

Class

BlockFormAlterTest
@coversDefaultClass \Drupal\block_style_plugins\BlockFormAlter @group block_style_plugins

Namespace

Drupal\Tests\block_style_plugins\Unit

Code

public function testGetBlockContentBundle() {
  $entity = $this
    ->prophesize(EntityInterface::class);
  $entity
    ->bundle()
    ->willReturn('basic_custom_block');
  $this->entityRepository
    ->loadEntityByUuid('block_content', 'uuid-1234')
    ->willReturn($entity
    ->reveal());
  $block = $this
    ->prophesize(Block::class);
  $block
    ->getPlugin()
    ->willReturn($this->blockPlugin
    ->reveal());
  $blockForm = $this
    ->prophesize(BlockForm::class);
  $blockForm
    ->getEntity()
    ->willReturn($block
    ->reveal());
  $this->formState
    ->getFormObject()
    ->willReturn($blockForm
    ->reveal());
  $bundle = $this->classInstance
    ->getBlockContentBundle($this->formState
    ->reveal());
  $this
    ->assertEquals('basic_custom_block', $bundle);
}