1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace ArpTest\EventDispatcher; |
||
6 | |||
7 | use Arp\EventDispatcher\ImmutableEventDispatcher; |
||
8 | use PHPUnit\Framework\MockObject\MockObject; |
||
9 | use PHPUnit\Framework\TestCase; |
||
10 | use Psr\EventDispatcher\EventDispatcherInterface; |
||
11 | use Psr\EventDispatcher\ListenerProviderInterface; |
||
12 | |||
13 | /** |
||
14 | * @covers \Arp\EventDispatcher\ImmutableEventDispatcher |
||
15 | * @covers \Arp\EventDispatcher\AbstractEventDispatcher |
||
16 | */ |
||
17 | final class ImmutableEventDispatcherTest extends TestCase |
||
18 | { |
||
19 | private ListenerProviderInterface&MockObject $listenerProvider; |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
20 | |||
21 | public function setUp(): void |
||
22 | { |
||
23 | $this->listenerProvider = $this->getMockForAbstractClass(ListenerProviderInterface::class); |
||
24 | } |
||
25 | |||
26 | public function testImplementsEventDispatcherInterface(): void |
||
27 | { |
||
28 | $eventDispatcher = new ImmutableEventDispatcher($this->listenerProvider); |
||
29 | |||
30 | $this->assertInstanceOf(EventDispatcherInterface::class, $eventDispatcher); |
||
31 | } |
||
32 | |||
33 | public function testDispatchOfInternalEventDispatcher(): void |
||
34 | { |
||
35 | $eventDispatcher = new ImmutableEventDispatcher($this->listenerProvider); |
||
36 | |||
37 | $this->listenerProvider->expects($this->once()) |
||
38 | ->method('getListenersForEvent') |
||
39 | ->willReturn([]); |
||
40 | |||
41 | $eventDispatcher->dispatch(new \stdClass()); |
||
42 | } |
||
43 | } |
||
44 |