File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -250,13 +250,27 @@ public function testUnserialize()
250250 }
251251
252252 /**
253- * @expectedException \PHPUnit_Framework_Error_Notice
253+ * __wakeup()
254254 */
255255 public function testUnserializeError ()
256256 {
257+ $ this ->expectError ('Notice ' );
257258 $ ser = 'O:30:"MyCLabs\Tests\Enum\EnumFixture":2:{ '
258259 . 's:23:"#MyCLabs\Enum\Enum#name";s:3:"FOO"; '
259260 . 's:24:"#MyCLabs\Enum\Enum#value";s:3:"foo";} ' ;
260261 $ foo = unserialize (strtr ($ ser , "# " , "\0" ));
261262 }
263+
264+ /**
265+ * Set expectedException for errors
266+ * @param string $name Exception
267+ */
268+ private function expectError ($ name )
269+ {
270+ $ ex = "PHPUnit_Framework_Error_ $ name " ;
271+ if (class_exists ($ ex ))
272+ $ this ->expectException ($ ex );
273+ else
274+ $ this ->expectException (strtr ($ ex , '_ ' , '\\' ));
275+ }
262276}
You can’t perform that action at this time.
0 commit comments