You are here

class HookEventDispatcherManagerTest in Hook Event Dispatcher 8.2

Same name and namespace in other branches
  1. 8 tests/src/Unit/Manager/HookEventDispatcherManagerTest.php \Drupal\Tests\hook_event_dispatcher\Unit\Manager\HookEventDispatcherManagerTest
  2. 3.x tests/src/Unit/Manager/HookEventDispatcherManagerTest.php \Drupal\Tests\hook_event_dispatcher\Unit\Manager\HookEventDispatcherManagerTest

Class HookEventDispatcherManagerTest.

@package Drupal\Tests\hook_event_dispatcher\Unit\Manager

@group hook_event_dispatcher

Hierarchy

Expanded class hierarchy of HookEventDispatcherManagerTest

File

tests/src/Unit/Manager/HookEventDispatcherManagerTest.php, line 16

Namespace

Drupal\Tests\hook_event_dispatcher\Unit\Manager
View source
class HookEventDispatcherManagerTest extends TestCase {

  /**
   * Test event dispatcher.
   */
  public function testEventDispatcher() : void {
    $event = new FakeEvent('test');
    $dispatcher = $this
      ->createMock(EventDispatcherInterface::class);
    $dispatcher
      ->method('dispatch')
      ->with('test', $event)
      ->willReturn($event);
    $manager = new HookEventDispatcherManager($dispatcher);
    $returnedEvent = $manager
      ->register($event);
    self::assertSame($event, $returnedEvent);
  }

}

Members