public function HookEventDispatcherManagerTest::testEventDispatcher in Hook Event Dispatcher 3.x
Same name and namespace in other branches
- 8.2 tests/src/Unit/Manager/HookEventDispatcherManagerTest.php \Drupal\Tests\hook_event_dispatcher\Unit\Manager\HookEventDispatcherManagerTest::testEventDispatcher()
- 8 tests/src/Unit/Manager/HookEventDispatcherManagerTest.php \Drupal\Tests\hook_event_dispatcher\Unit\Manager\HookEventDispatcherManagerTest::testEventDispatcher()
Test event dispatcher.
File
- tests/
src/ Unit/ Manager/ HookEventDispatcherManagerTest.php, line 21
Class
- HookEventDispatcherManagerTest
- Class HookEventDispatcherManagerTest.
Namespace
Drupal\Tests\hook_event_dispatcher\Unit\ManagerCode
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);
}