public function EntityViewEventTest::testEntityBuildDefaultsAlterWithNullViewMode in Hook Event Dispatcher 8.2
Same name and namespace in other branches
- 3.x modules/core_event_dispatcher/tests/src/Unit/Entity/EntityViewEventTest.php \Drupal\Tests\core_event_dispatcher\Unit\Entity\EntityViewEventTest::testEntityBuildDefaultsAlterWithNullViewMode()
Test EntityBuildDefaultsAlter.
File
- modules/
core_event_dispatcher/ tests/ src/ Unit/ Entity/ EntityViewEventTest.php, line 123
Class
- EntityViewEventTest
- Class EntityViewEventTest.
Namespace
Drupal\Tests\core_event_dispatcher\Unit\EntityCode
public function testEntityBuildDefaultsAlterWithNullViewMode() : void {
$build = [
'testBuild' => [
'someBuild',
],
];
$entity = $this
->createMock(EntityInterface::class);
$viewMode = NULL;
core_event_dispatcher_entity_build_defaults_alter($build, $entity, $viewMode);
/** @var \Drupal\core_event_dispatcher\Event\Entity\EntityBuildDefaultsAlterEvent $event */
$event = $this->manager
->getRegisteredEvent(HookEventDispatcherInterface::ENTITY_BUILD_DEFAULTS_ALTER);
self::assertSame($build, $event
->getBuild());
self::assertSame($entity, $event
->getEntity());
self::assertSame((string) $viewMode, $event
->getViewMode());
}