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()
250
250
}
251
251
252
252
/**
253
- * @expectedException \PHPUnit_Framework_Error_Notice
253
+ * __wakeup()
254
254
*/
255
255
public function testUnserializeError ()
256
256
{
257
+ $ this ->expectError ('Notice ' );
257
258
$ ser = 'O:30:"MyCLabs\Tests\Enum\EnumFixture":2:{ '
258
259
. 's:23:"#MyCLabs\Enum\Enum#name";s:3:"FOO"; '
259
260
. 's:24:"#MyCLabs\Enum\Enum#value";s:3:"foo";} ' ;
260
261
$ foo = unserialize (strtr ($ ser , "# " , "\0" ));
261
262
}
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
+ }
262
276
}
You can’t perform that action at this time.
0 commit comments