You are here

public function EntityEventTest::testEntityCreateEvent in Hook Event Dispatcher 8

Test EntityCreateEvent.

File

tests/src/Unit/Entity/EntityEventTest.php, line 41

Class

EntityEventTest
Class EntityEventTest.

Namespace

Drupal\Tests\hook_event_dispatcher\Unit\Entity

Code

public function testEntityCreateEvent() {
  $entity = $this
    ->createMock(EntityInterface::class);
  hook_event_dispatcher_entity_create($entity);

  /** @var \Drupal\hook_event_dispatcher\Event\Entity\EntityCreateEvent $event */
  $event = $this->manager
    ->getRegisteredEvent(HookEventDispatcherInterface::ENTITY_CREATE);
  self::assertEquals($entity, $event
    ->getEntity());
}