File tree Expand file tree Collapse file tree 3 files changed +66
-3
lines changed
tests/end-to-end/regression Expand file tree Collapse file tree 3 files changed +66
-3
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,13 @@ All notable changes of the PHPUnit 11.0 release series are documented in this fi
44
55## [ 11.0.3] - 2024-MM-DD
66
7+ ### Changed
8+
9+ * Tests that do not unregister their error handlers or exception handlers are no longer considered risky when they are run in an isolated process
10+
711### Fixed
812
9- * When a test (or the code called from it) does not remove its own error handlers and its own exception handlers then only the latter was reported
13+ * When a test (or the code called from it) does not unregister its own error handlers and its own exception handlers then only the latter was reported
1014* Resource usage information is printed when the ` --debug ` CLI option is used
1115
1216## [ 11.0.2] - 2024-04-04
Original file line number Diff line number Diff line change @@ -1836,7 +1836,9 @@ private function restoreGlobalErrorExceptionHandlers(): void
18361836
18371837 if ($ activeErrorHandlers !== $ this ->backupGlobalErrorHandlers ) {
18381838 if (count ($ activeErrorHandlers ) > count ($ this ->backupGlobalErrorHandlers )) {
1839- $ message = 'Test code or tested code did not remove its own error handlers ' ;
1839+ if (!$ this ->inIsolation ) {
1840+ $ message = 'Test code or tested code did not remove its own error handlers ' ;
1841+ }
18401842 } else {
18411843 $ message = 'Test code or tested code removed error handlers other than its own ' ;
18421844 }
@@ -1863,7 +1865,9 @@ private function restoreGlobalErrorExceptionHandlers(): void
18631865
18641866 if ($ activeExceptionHandlers !== $ this ->backupGlobalExceptionHandlers ) {
18651867 if (count ($ activeExceptionHandlers ) > count ($ this ->backupGlobalExceptionHandlers )) {
1866- $ message = 'Test code or tested code did not remove its own exception handlers ' ;
1868+ if (!$ this ->inIsolation ) {
1869+ $ message = 'Test code or tested code did not remove its own exception handlers ' ;
1870+ }
18671871 } else {
18681872 $ message = 'Test code or tested code removed exception handlers other than its own ' ;
18691873 }
Original file line number Diff line number Diff line change 1+ --TEST--
2+ https://github.com/sebastianbergmann/phpunit/pull/5592
3+ --FILE--
4+ <?php declare (strict_types=1 );
5+ $ _SERVER ['argv ' ][] = '--do-not-cache-result ' ;
6+ $ _SERVER ['argv ' ][] = '--no-configuration ' ;
7+ $ _SERVER ['argv ' ][] = '--process-isolation ' ;
8+ $ _SERVER ['argv ' ][] = __DIR__ . '/5592/Issue5592Test.php ' ;
9+
10+ set_exception_handler (static fn () => null );
11+
12+ require_once __DIR__ . '/../../bootstrap.php ' ;
13+ (new PHPUnit \TextUI \Application )->run ($ _SERVER ['argv ' ]);
14+ --EXPECTF --
15+ PHPUnit %s by Sebastian Bergmann and contributors.
16+
17+ Runtime: %s
18+
19+ .FF .FF 6 / 6 (100 %)
20+
21+ Time: %s, Memory: %s
22+
23+ There were 4 failures:
24+
25+ 1 ) PHPUnit \TestFixture \Issue5592Test::testAddedErrorHandler
26+ Failed asserting that false is true .
27+
28+ %sIssue5592Test.php:%i
29+
30+ 2 ) PHPUnit\TestFixture \Issue5592Test::testRemovedErrorHandler
31+ Failed asserting that false is true.
32+
33+ %sIssue5592Test.php:%i
34+
35+ 3 ) PHPUnit\TestFixture \Issue5592Test::testAddedExceptionHandler
36+ Failed asserting that false is true.
37+
38+ %sIssue5592Test.php:%i
39+
40+ 4 ) PHPUnit\TestFixture \Issue5592Test::testRemovedExceptionHandler
41+ Failed asserting that false is true.
42+
43+ %sIssue5592Test.php:%i
44+
45+ --
46+
47+ There was 1 risky test:
48+
49+ 1 ) PHPUnit \TestFixture \Issue5592Test::testRemovedErrorHandler
50+ Test code or tested code removed error handlers other than its own
51+
52+ %sIssue5592Test.php:%i
53+
54+ FAILURES !
55+ Tests: 6 , Assertions: 6 , Failures: 4 , Risky: 1.
You can’t perform that action at this time.
0 commit comments