public function PanelizerEntityViewBuilderTest::testBuildComponents in Panelizer 8.3
Same name and namespace in other branches
- 8.5 tests/src/Unit/PanelizerEntityViewBuilderTest.php \Drupal\Tests\panelizer\Unit\PanelizerEntityViewBuilderTest::testBuildComponents()
- 8.4 tests/src/Unit/PanelizerEntityViewBuilderTest.php \Drupal\Tests\panelizer\Unit\PanelizerEntityViewBuilderTest::testBuildComponents()
Tests buildComponents().
@covers ::buildComponents
File
- tests/
src/ Unit/ PanelizerEntityViewBuilderTest.php, line 137
Class
- PanelizerEntityViewBuilderTest
- Tests the PanelizerEntityViewBuilder.
Namespace
Drupal\Tests\panelizer\UnitCode
public function testBuildComponents() {
$build = [
'random_value' => 123,
];
$entity1 = $this
->prophesize(FieldableEntityInterface::class);
$entity1
->bundle()
->willReturn('abc');
$display1 = $this
->prophesize(EntityViewDisplayInterface::class);
$display1
->getThirdPartySetting('panelizer', 'enable', FALSE)
->willReturn(TRUE);
$entity2 = $this
->prophesize(FieldableEntityInterface::class);
$entity2
->bundle()
->willReturn('xyz');
$display2 = $this
->prophesize(EntityViewDisplayInterface::class);
$display2
->getThirdPartySetting('panelizer', 'enable', FALSE)
->willReturn(FALSE);
$displays = [
'abc' => $display1
->reveal(),
'xyz' => $display2
->reveal(),
];
$this->fallbackViewBuilder
->buildComponents($build, [
234 => $entity2
->reveal(),
], $displays, 'full')
->shouldBeCalled();
$this->moduleHandler
->invokeAll('entity_prepare_view', [
'entity_type_id',
[
123 => $entity1
->reveal(),
],
$displays,
'full',
])
->shouldBeCalled();
$this->entityViewBuilder
->buildComponents($build, [
123 => $entity1
->reveal(),
234 => $entity2
->reveal(),
], $displays, 'full');
}