Conditions | 1 |
Paths | 1 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
18 | public function test_dispatch() |
||
19 | { |
||
20 | $manager = Books::instance(); |
||
21 | |||
22 | $emanager = EventManager::instance(); |
||
23 | |||
24 | $called = 0; |
||
25 | $emanager->registerModelEvent( |
||
26 | Observe::RETRIEVED, |
||
27 | $manager, |
||
28 | function () use (&$called) { |
||
29 | $called++; |
||
30 | } |
||
31 | ); |
||
32 | |||
33 | $event = Event::create(Observe::RETRIEVED, $manager); |
||
34 | $emanager->dispatch($event); |
||
35 | $emanager->dispatch($event); |
||
36 | |||
37 | self::assertSame(2, $called); |
||
38 | } |
||
39 | } |