@@ 14-21 (lines=8) @@ | ||
11 | /** |
|
12 | * @test |
|
13 | */ |
|
14 | public function using_a_event_dispatcher(): void |
|
15 | { |
|
16 | $instance = $this->eventDispatcherAwareInstance(); |
|
17 | $dispatcher = new EventDispatcher(); |
|
18 | $instance->useEventDispatcher($dispatcher); |
|
19 | ||
20 | $this->assertSame($dispatcher, $instance->eventDispatcher()); |
|
21 | } |
|
22 | ||
23 | /** |
|
24 | * @test |
|
@@ 26-33 (lines=8) @@ | ||
23 | /** |
|
24 | * @test |
|
25 | */ |
|
26 | public function when_no_dispatcher_is_provided_a_dispatcher_is_created(): void |
|
27 | { |
|
28 | $instance = $this->eventDispatcherAwareInstance(); |
|
29 | ||
30 | $eventDispatcher = $instance->eventDispatcher(); |
|
31 | $this->assertInstanceOf(EventDispatcher::class, $eventDispatcher); |
|
32 | $this->assertSame($eventDispatcher, $instance->eventDispatcher()); |
|
33 | } |
|
34 | ||
35 | private function eventDispatcherAwareInstance(): EventDispatcherAware |
|
36 | { |