Skip to content

Commit e4fbcc6

Browse files
committed
fix testing deprecation messages
* always restore the previous error handler * throw `LogicExcetion` when unexpected error type is triggered
1 parent 584e52c commit e4fbcc6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Tests/ParserTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,9 +889,13 @@ public function testColonInMappingValueException()
889889

890890
$deprecations = array();
891891
set_error_handler(function ($type, $msg) use (&$deprecations) {
892-
if (E_USER_DEPRECATED === $type) {
893-
$deprecations[] = $msg;
892+
if (E_USER_DEPRECATED !== $type) {
893+
restore_error_handler();
894+
895+
return call_user_func_array('PHPUnit_Util_ErrorHandler::handleError', func_get_args());
894896
}
897+
898+
$deprecations[] = $msg;
895899
});
896900

897901
$this->parser->parse($yaml);

0 commit comments

Comments
 (0)