File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
src/Symfony/Bridge/PhpUnit Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,12 @@ public static function collectDeprecations($outputFile)
255
255
}
256
256
$ deprecations [] = array (error_reporting (), $ msg );
257
257
});
258
+ // This can be registered before the PHPUnit error handler.
259
+ if (!$ previousErrorHandler ) {
260
+ $ UtilPrefix = class_exists ('PHPUnit_Util_ErrorHandler ' ) ? 'PHPUnit_Util_ ' : 'PHPUnit\Util \\' ;
261
+ $ previousErrorHandler = $ UtilPrefix .'ErrorHandler::handleError ' ;
262
+ }
263
+
258
264
register_shutdown_function (function () use ($ outputFile , &$ deprecations ) {
259
265
file_put_contents ($ outputFile , serialize ($ deprecations ));
260
266
});
Original file line number Diff line number Diff line change @@ -21,4 +21,17 @@ public function testIsolation()
21
21
@trigger_error ('Test abc ' , E_USER_DEPRECATED );
22
22
$ this ->addToAssertionCount (1 );
23
23
}
24
+
25
+ public function testCallingOtherErrorHandler ()
26
+ {
27
+ $ class = class_exists ('PHPUnit\Framework\Exception ' ) ? 'PHPUnit\Framework\Exception ' : 'PHPUnit_Framework_Exception ' ;
28
+ if (method_exists ($ this , 'expectException ' )) {
29
+ $ this ->expectException ($ class );
30
+ $ this ->expectExceptionMessage ('Test that PHPUnit \'s error handler fires. ' );
31
+ } else {
32
+ $ this ->setExpectedException ($ class , 'Test that PHPUnit \'s error handler fires. ' );
33
+ }
34
+
35
+ trigger_error ('Test that PHPUnit \'s error handler fires. ' , E_USER_WARNING );
36
+ }
24
37
}
You can’t perform that action at this time.
0 commit comments