|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Onoi\EventDispatcher\Tests; |
|
4
|
|
|
|
|
5
|
|
|
use Onoi\EventDispatcher\EventDispatcherFactory; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* @covers \Onoi\EventDispatcher\EventDispatcherFactory |
|
9
|
|
|
* |
|
10
|
|
|
* @group onoi-event-dispatcher |
|
11
|
|
|
* |
|
12
|
|
|
* @license GNU GPL v2+ |
|
13
|
|
|
* @since 1.0 |
|
14
|
|
|
* |
|
15
|
|
|
* @author mwjames |
|
16
|
|
|
*/ |
|
17
|
|
|
class EventDispatcherFactoryTest extends \PHPUnit_Framework_TestCase { |
|
18
|
|
|
|
|
19
|
|
|
public function testCanConstruct() { |
|
20
|
|
|
|
|
21
|
|
|
$instance = new EventDispatcherFactory(); |
|
22
|
|
|
|
|
23
|
|
|
$this->assertInstanceOf( |
|
24
|
|
|
'\Onoi\EventDispatcher\EventDispatcherFactory', |
|
25
|
|
|
$instance |
|
26
|
|
|
); |
|
27
|
|
|
|
|
28
|
|
|
$this->assertInstanceOf( |
|
29
|
|
|
'\Onoi\EventDispatcher\EventDispatcherFactory', |
|
30
|
|
|
EventDispatcherFactory::getInstance() |
|
31
|
|
|
); |
|
32
|
|
|
|
|
33
|
|
|
EventDispatcherFactory::clear(); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function testCanConstructDispatchContext() { |
|
37
|
|
|
|
|
38
|
|
|
$instance = new EventDispatcherFactory(); |
|
39
|
|
|
|
|
40
|
|
|
$this->assertInstanceOf( |
|
41
|
|
|
'\Onoi\EventDispatcher\DispatchContext', |
|
42
|
|
|
$instance->newDispatchContext() |
|
43
|
|
|
); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function testCanConstructGenericEventDispatcher() { |
|
47
|
|
|
|
|
48
|
|
|
$instance = new EventDispatcherFactory(); |
|
49
|
|
|
|
|
50
|
|
|
$this->assertInstanceOf( |
|
51
|
|
|
'\Onoi\EventDispatcher\Dispatcher\GenericEventDispatcher', |
|
52
|
|
|
$instance->newGenericEventDispatcher() |
|
53
|
|
|
); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function testCanConstructNullEventListener() { |
|
57
|
|
|
|
|
58
|
|
|
$instance = new EventDispatcherFactory(); |
|
59
|
|
|
|
|
60
|
|
|
$this->assertInstanceOf( |
|
61
|
|
|
'\Onoi\EventDispatcher\Listener\NullEventListener', |
|
62
|
|
|
$instance->newNullEventListener() |
|
63
|
|
|
); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function testCanConstructGenericCallbackEventListener() { |
|
67
|
|
|
|
|
68
|
|
|
$instance = new EventDispatcherFactory(); |
|
69
|
|
|
|
|
70
|
|
|
$this->assertInstanceOf( |
|
71
|
|
|
'\Onoi\EventDispatcher\Listener\GenericCallbackEventListener', |
|
72
|
|
|
$instance->newGenericCallbackEventListener() |
|
73
|
|
|
); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
public function testCanConstructGenericEventListenerCollection() { |
|
77
|
|
|
|
|
78
|
|
|
$instance = new EventDispatcherFactory(); |
|
79
|
|
|
|
|
80
|
|
|
$this->assertInstanceOf( |
|
81
|
|
|
'\Onoi\EventDispatcher\Listener\GenericEventListenerCollection', |
|
82
|
|
|
$instance->newGenericEventListenerCollection() |
|
83
|
|
|
); |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
} |
|
87
|
|
|
|