function BlockVariantTraitTest::testGetRegionAssignments

Same name and namespace in other branches
  1. 4.0.x tests/src/Unit/BlockVariantTraitTest.php \Drupal\Tests\ctools\Unit\BlockVariantTraitTest::testGetRegionAssignments()

Tests the getRegionAssignments() method.

@covers ::getRegionAssignments

@dataProvider providerTestGetRegionAssignments

File

tests/src/Unit/BlockVariantTraitTest.php, line 28

Class

BlockVariantTraitTest
Tests the methods of a block-based variant.

Namespace

Drupal\Tests\ctools\Unit

Code

public function testGetRegionAssignments($expected, $blocks = []) {
  $block_collection = $this->prophesize(BlockPluginCollection::class);
  $block_collection->getAllByRegion()
    ->willReturn($blocks)
    ->shouldBeCalled();
  $display_variant = new TestBlockVariantTrait();
  $display_variant->setBlockPluginCollection($block_collection->reveal());
  $this->assertSame($expected, $display_variant->getRegionAssignments());
}