You are here

public function EntityEventTest::testEntityLoadEvent in Hook Event Dispatcher 8

Test EntityLoadEvent.

File

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

Class

EntityEventTest
Class EntityEventTest.

Namespace

Drupal\Tests\hook_event_dispatcher\Unit\Entity

Code

public function testEntityLoadEvent() {
  $entities = [
    $this
      ->createMock(EntityInterface::class),
    $this
      ->createMock(EntityInterface::class),
    $this
      ->createMock(EntityInterface::class),
  ];
  $entityTypeId = 'test';
  hook_event_dispatcher_entity_load($entities, $entityTypeId);

  /** @var \Drupal\hook_event_dispatcher\Event\Entity\EntityLoadEvent $event */
  $event = $this->manager
    ->getRegisteredEvent(HookEventDispatcherInterface::ENTITY_LOAD);
  self::assertEquals($entities, $event
    ->getEntities());
  self::assertEquals($entityTypeId, $event
    ->getEntityTypeId());
}