public function EntityEventTest::testEntityUpdateEvent in Hook Event Dispatcher 8
Test EntityUpdateEvent.
File
- tests/
src/ Unit/ Entity/ EntityEventTest.php, line 154
Class
- EntityEventTest
- Class EntityEventTest.
Namespace
Drupal\Tests\hook_event_dispatcher\Unit\EntityCode
public function testEntityUpdateEvent() {
$entity = $this
->createMock(EntityInterface::class);
$originalEntity = $this
->createMock(EntityInterface::class);
$entity->original = $originalEntity;
hook_event_dispatcher_entity_update($entity);
/** @var \Drupal\hook_event_dispatcher\Event\Entity\EntityUpdateEvent $event */
$event = $this->manager
->getRegisteredEvent(HookEventDispatcherInterface::ENTITY_UPDATE);
self::assertEquals($entity, $event
->getEntity());
self::assertEquals($originalEntity, $event
->getOriginalEntity());
}