public function DisplayHelperTest::testNewComponents in Lightning Core 8
Same name and namespace in other branches
- 8.5 tests/src/Unit/DisplayHelperTest.php \Drupal\Tests\lightning_core\Unit\DisplayHelperTest::testNewComponents()
- 8.2 tests/src/Unit/DisplayHelperTest.php \Drupal\Tests\lightning_core\Unit\DisplayHelperTest::testNewComponents()
- 8.3 tests/src/Unit/DisplayHelperTest.php \Drupal\Tests\lightning_core\Unit\DisplayHelperTest::testNewComponents()
- 8.4 tests/src/Unit/DisplayHelperTest.php \Drupal\Tests\lightning_core\Unit\DisplayHelperTest::testNewComponents()
@covers ::getNewComponents
File
- tests/
src/ Unit/ DisplayHelperTest.php, line 22
Class
- DisplayHelperTest
- @coversDefaultClass \Drupal\lightning_core\DisplayHelper
Namespace
Drupal\Tests\lightning_core\UnitCode
public function testNewComponents() {
/** @var \Drupal\Core\Entity\Display\EntityDisplayInterface|\Prophecy\Prophecy\ProphecyInterface $display */
$display = $this
->prophesize(EntityDisplayInterface::class);
$display
->getComponents()
->willReturn([
'foo' => [
'type' => 'fubar',
],
'bar' => [
'type' => 'pastafazoul',
],
]);
/** @var \Drupal\Core\Entity\Display\EntityDisplayInterface|\Prophecy\Prophecy\ProphecyInterface $original */
$original = $this
->prophesize(EntityDisplayInterface::class);
$original
->getComponents()
->willReturn([
'foo' => [
'type' => 'fubar',
],
]);
$display = $display
->reveal();
$display->original = $original
->reveal();
$helper = new DisplayHelper($this
->prophesize(QueryFactory::class)
->reveal(), $this
->prophesize(EntityFieldManagerInterface::class)
->reveal());
$components = $helper
->getNewComponents($display);
$this
->assertArrayHasKey('bar', $components);
$this
->assertArrayNotHasKey('foo', $components);
}