You are here

public function EntityEventTest::testEntityInsertEvent in Hook Event Dispatcher 8.2

Same name and namespace in other branches
  1. 3.x modules/core_event_dispatcher/tests/src/Unit/Entity/EntityEventTest.php \Drupal\Tests\core_event_dispatcher\Unit\Entity\EntityEventTest::testEntityInsertEvent()

Test EntityInsertEvent.

File

modules/core_event_dispatcher/tests/src/Unit/Entity/EntityEventTest.php, line 75

Class

EntityEventTest
Class EntityEventTest.

Namespace

Drupal\Tests\core_event_dispatcher\Unit\Entity

Code

public function testEntityInsertEvent() : void {
  $entity = $this
    ->createMock(EntityInterface::class);
  core_event_dispatcher_entity_insert($entity);

  /** @var \Drupal\core_event_dispatcher\Event\Entity\EntityInsertEvent $event */
  $event = $this->manager
    ->getRegisteredEvent(HookEventDispatcherInterface::ENTITY_INSERT);
  self::assertSame($entity, $event
    ->getEntity());
}