Conditions | 1 |
Paths | 1 |
Total Lines | 21 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
16 | public function testDispatch() |
||
17 | { |
||
18 | $dispatcher = $this->newMockDispatcher(); |
||
19 | $listener = new SimpleListener(); |
||
20 | |||
21 | $dispatcher->addListener('preFoo', $listener); |
||
22 | $dispatcher->addListener('postFoo', $listener); |
||
23 | |||
24 | $event = Event::named('preFoo'); |
||
25 | $dispatcher->dispatch($event, 'preFoo'); |
||
26 | |||
27 | static::assertTrue($listener->invoked('preFoo')); |
||
28 | static::assertFalse($listener->invoked('postFoo')); |
||
29 | |||
30 | static::assertInstanceOf( |
||
31 | Event::class, |
||
32 | $dispatcher->dispatch(Event::named('noevent')) |
||
33 | ); |
||
34 | static::assertInstanceOf( |
||
35 | EventInterface::class, |
||
36 | $dispatcher->dispatch(new Event()) |
||
37 | ); |
||
49 |