public function EntityViewEventTest::testEntityBuildDefaultsAlterWithNullViewMode in Hook Event Dispatcher 8
Test EntityBuildDefaultsAlter.
File
- tests/
src/ Unit/ Entity/ EntityViewEventTest.php, line 152
Class
- EntityViewEventTest
- Class EntityViewEventTest.
Namespace
Drupal\Tests\hook_event_dispatcher\Unit\EntityCode
public function testEntityBuildDefaultsAlterWithNullViewMode() {
$build = [
'testBuild' => [
'someBuild',
],
];
$entity = $this
->createMock(EntityInterface::class);
$viewMode = NULL;
hook_event_dispatcher_entity_build_defaults_alter($build, $entity, $viewMode);
/** @var \Drupal\hook_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());
}