File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
tests/TestCase/Controller/Component Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -147,4 +147,36 @@ public function testSetWithComponentConfiguration()
147
147
$ result = $ this ->Session ->read ('Flash.flash ' );
148
148
$ this ->assertEquals ($ expected , $ result );
149
149
}
150
+
151
+ /**
152
+ * Test magic call method.
153
+ *
154
+ * @covers \Cake\Controller\Component\FlashComponent::__call
155
+ * @return void
156
+ */
157
+ public function testCall ()
158
+ {
159
+ $ this ->assertNull ($ this ->Session ->read ('Flash.flash ' ));
160
+
161
+ $ this ->Flash ->success ('It worked ' );
162
+ $ expected = [
163
+ 'message ' => 'It worked ' ,
164
+ 'key ' => 'flash ' ,
165
+ 'element ' => 'Flash/success ' ,
166
+ 'params ' => []
167
+ ];
168
+ $ result = $ this ->Session ->read ('Flash.flash ' );
169
+ $ this ->assertEquals ($ expected , $ result );
170
+
171
+ $ this ->Flash ->error ('It did not work ' , ['element ' => 'error_thing ' ]);
172
+
173
+ $ expected = [
174
+ 'message ' => 'It did not work ' ,
175
+ 'key ' => 'flash ' ,
176
+ 'element ' => 'Flash/error ' ,
177
+ 'params ' => []
178
+ ];
179
+ $ result = $ this ->Session ->read ('Flash.flash ' );
180
+ $ this ->assertEquals ($ expected , $ result , 'Element is ignored in magic call. ' );
181
+ }
150
182
}
You can’t perform that action at this time.
0 commit comments