HookEventDispatcherManagerTest.php in Hook Event Dispatcher 8
Same filename and directory in other branches
File
tests/src/Unit/Manager/HookEventDispatcherManagerTest.phpView source
<?php
namespace Drupal\Tests\hook_event_dispatcher\Unit\Manager;
use Drupal\hook_event_dispatcher\Manager\HookEventDispatcherManager;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
* Class HookEventDispatcherManagerTest.
*
* @package Drupal\Tests\hook_event_dispatcher\Unit\Manager
*
* @group hook_event_dispatcher
*/
class HookEventDispatcherManagerTest extends UnitTestCase {
/**
* Test event dispatcher.
*/
public function testEventDispatcher() {
$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::assertEquals($event, $returnedEvent);
}
}
Classes
Name | Description |
---|---|
HookEventDispatcherManagerTest | Class HookEventDispatcherManagerTest. |