These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace Redaxscript\Tests\Module; |
||
3 | |||
4 | use Redaxscript\Module; |
||
5 | use Redaxscript\Tests\TestCaseAbstract; |
||
6 | |||
7 | /** |
||
8 | * HookTest |
||
9 | * |
||
10 | * @since 2.4.0 |
||
11 | * |
||
12 | * @package Redaxscript |
||
13 | * @category Tests |
||
14 | * @author Henry Ruhs |
||
15 | * |
||
16 | * @covers Redaxscript\Module\Hook |
||
17 | */ |
||
18 | |||
19 | class HookTest extends TestCaseAbstract |
||
20 | { |
||
21 | /** |
||
22 | * setUp |
||
23 | * |
||
24 | * @since 3.1.0 |
||
25 | */ |
||
26 | |||
27 | public function setUp() : void |
||
28 | { |
||
29 | parent::setUp(); |
||
30 | $this->createDatabase(); |
||
0 ignored issues
–
show
|
|||
31 | $this->installTestDummy(); |
||
0 ignored issues
–
show
The method
installTestDummy() does not seem to exist on object<Redaxscript\Tests\Module\HookTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
32 | } |
||
33 | |||
34 | /** |
||
35 | * tearDown |
||
36 | * |
||
37 | * @since 3.1.0 |
||
38 | */ |
||
39 | |||
40 | public function tearDown() : void |
||
41 | { |
||
42 | $this->uninstallTestDummy(); |
||
0 ignored issues
–
show
The method
uninstallTestDummy() does not seem to exist on object<Redaxscript\Tests\Module\HookTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
43 | $this->dropDatabase(); |
||
0 ignored issues
–
show
The method
dropDatabase() does not seem to exist on object<Redaxscript\Tests\Module\HookTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
44 | } |
||
45 | |||
46 | /** |
||
47 | * testGetModuleArray |
||
48 | * |
||
49 | * @since 2.4.0 |
||
50 | */ |
||
51 | |||
52 | public function testGetModuleArray() : void |
||
53 | { |
||
54 | /* setup */ |
||
55 | |||
56 | Module\Hook::construct($this->_registry, $this->_request, $this->_language, $this->_config); |
||
57 | Module\Hook::init(); |
||
58 | |||
59 | /* actual */ |
||
60 | |||
61 | $actualArray = Module\Hook::getModuleArray(); |
||
62 | |||
63 | /* compare */ |
||
64 | |||
65 | $this->assertArrayHasKey('TestDummy', $actualArray); |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * testGetEventArray |
||
70 | * |
||
71 | * @since 2.4.0 |
||
72 | */ |
||
73 | |||
74 | public function testGetEventArray() : void |
||
75 | { |
||
76 | /* setup */ |
||
77 | |||
78 | Module\Hook::construct($this->_registry, $this->_request, $this->_language, $this->_config); |
||
79 | Module\Hook::init(); |
||
80 | Module\Hook::trigger('render'); |
||
81 | |||
82 | /* actual */ |
||
83 | |||
84 | $actualArray = Module\Hook::getEventArray(); |
||
85 | |||
86 | /* compare */ |
||
87 | |||
88 | $this->assertArrayHasKey('render', $actualArray); |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * testCollect |
||
93 | * |
||
94 | * @since 2.4.0 |
||
95 | * |
||
96 | * @param array $expectArray |
||
97 | * |
||
98 | * @dataProvider providerAutoloader |
||
99 | */ |
||
100 | |||
101 | public function testCollect(array $expectArray = []) : void |
||
102 | { |
||
103 | /* setup */ |
||
104 | |||
105 | Module\Hook::construct($this->_registry, $this->_request, $this->_language, $this->_config); |
||
106 | Module\Hook::init(); |
||
107 | |||
108 | /* actual */ |
||
109 | |||
110 | $actualArray = Module\Hook::collect('adminNotification'); |
||
111 | |||
112 | /* compare */ |
||
113 | |||
114 | $this->assertEquals($expectArray, $actualArray); |
||
115 | } |
||
116 | |||
117 | /** |
||
118 | * testCollectInvalid |
||
119 | * |
||
120 | * @since 3.0.0 |
||
121 | */ |
||
122 | |||
123 | public function testCollectInvalid() : void |
||
124 | { |
||
125 | /* setup */ |
||
126 | |||
127 | Module\Hook::construct($this->_registry, $this->_request, $this->_language, $this->_config); |
||
128 | Module\Hook::init(); |
||
129 | |||
130 | /* actual */ |
||
131 | |||
132 | $actual = Module\Hook::collect('invalidMethod'); |
||
133 | |||
134 | /* compare */ |
||
135 | |||
136 | $this->assertEmpty($actual); |
||
137 | } |
||
138 | |||
139 | /** |
||
140 | * testTrigger |
||
141 | * |
||
142 | * @since 2.4.0 |
||
143 | */ |
||
144 | |||
145 | public function testTrigger() : void |
||
146 | { |
||
147 | /* setup */ |
||
148 | |||
149 | Module\Hook::construct($this->_registry, $this->_request, $this->_language, $this->_config); |
||
150 | Module\Hook::init(); |
||
151 | |||
152 | /* actual */ |
||
153 | |||
154 | $actual = Module\Hook::trigger('render'); |
||
155 | |||
156 | /* compare */ |
||
157 | |||
158 | $this->assertEquals('Two', $actual); |
||
159 | } |
||
160 | |||
161 | /** |
||
162 | * testTriggerInvalid |
||
163 | * |
||
164 | * @since 2.4.0 |
||
165 | */ |
||
166 | |||
167 | public function testTriggerInvalid() : void |
||
168 | { |
||
169 | /* setup */ |
||
170 | |||
171 | Module\Hook::construct($this->_registry, $this->_request, $this->_language, $this->_config); |
||
172 | Module\Hook::init(); |
||
173 | |||
174 | /* actual */ |
||
175 | |||
176 | $actual = Module\Hook::trigger('invalidMethod'); |
||
177 | |||
178 | /* compare */ |
||
179 | |||
180 | $this->assertNull($actual); |
||
181 | } |
||
182 | } |
||
183 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.