You are here

public function BlockVariantTraitTest::testGetRegionAssignments in Chaos Tool Suite (ctools) 8.3

Tests the getRegionAssignments() method.

@covers ::getRegionAssignments

@dataProvider providerTestGetRegionAssignments

File

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

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());
}