From 5c45b13a262753c676525555f4689a9008d1852b Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Wed, 6 Aug 2025 09:29:32 +0200 Subject: [PATCH 1/2] Test events while process isolation --- .../5592-process-isolation-events.phpt | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 tests/end-to-end/regression/5592-process-isolation-events.phpt diff --git a/tests/end-to-end/regression/5592-process-isolation-events.phpt b/tests/end-to-end/regression/5592-process-isolation-events.phpt new file mode 100644 index 0000000000..3fcf21b265 --- /dev/null +++ b/tests/end-to-end/regression/5592-process-isolation-events.phpt @@ -0,0 +1,69 @@ +--TEST-- +https://github.com/sebastianbergmann/phpunit/pull/5592 +--FILE-- + null); + +require_once __DIR__ . '/../../bootstrap.php'; +(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Event Facade Sealed +Test Suite Loaded (6 tests) +Test Runner Started +Test Suite Sorted +Test Runner Execution Started (6 tests) +Test Suite Started (PHPUnit\TestFixture\Issue5592TestIsolation, 6 tests) +Child Process Started +Test Preparation Started (PHPUnit\TestFixture\Issue5592TestIsolation::testAddedAndRemovedErrorHandler) +Test Prepared (PHPUnit\TestFixture\Issue5592TestIsolation::testAddedAndRemovedErrorHandler) +Test Passed (PHPUnit\TestFixture\Issue5592TestIsolation::testAddedAndRemovedErrorHandler) +Test Finished (PHPUnit\TestFixture\Issue5592TestIsolation::testAddedAndRemovedErrorHandler) +Child Process Finished +Child Process Started +Test Preparation Started (PHPUnit\TestFixture\Issue5592TestIsolation::testAddedErrorHandler) +Test Prepared (PHPUnit\TestFixture\Issue5592TestIsolation::testAddedErrorHandler) +Test Failed (PHPUnit\TestFixture\Issue5592TestIsolation::testAddedErrorHandler) +Failed asserting that false is true. +Test Finished (PHPUnit\TestFixture\Issue5592TestIsolation::testAddedErrorHandler) +Child Process Finished +Child Process Started +Test Preparation Started (PHPUnit\TestFixture\Issue5592TestIsolation::testRemovedErrorHandler) +Test Prepared (PHPUnit\TestFixture\Issue5592TestIsolation::testRemovedErrorHandler) +Test Failed (PHPUnit\TestFixture\Issue5592TestIsolation::testRemovedErrorHandler) +Failed asserting that false is true. +Test Considered Risky (PHPUnit\TestFixture\Issue5592TestIsolation::testRemovedErrorHandler) +Test code or tested code removed error handlers other than its own +Test Finished (PHPUnit\TestFixture\Issue5592TestIsolation::testRemovedErrorHandler) +Child Process Finished +Child Process Started +Test Preparation Started (PHPUnit\TestFixture\Issue5592TestIsolation::testAddedAndRemovedExceptionHandler) +Test Prepared (PHPUnit\TestFixture\Issue5592TestIsolation::testAddedAndRemovedExceptionHandler) +Test Passed (PHPUnit\TestFixture\Issue5592TestIsolation::testAddedAndRemovedExceptionHandler) +Test Finished (PHPUnit\TestFixture\Issue5592TestIsolation::testAddedAndRemovedExceptionHandler) +Child Process Finished +Child Process Started +Test Preparation Started (PHPUnit\TestFixture\Issue5592TestIsolation::testAddedExceptionHandler) +Test Prepared (PHPUnit\TestFixture\Issue5592TestIsolation::testAddedExceptionHandler) +Test Failed (PHPUnit\TestFixture\Issue5592TestIsolation::testAddedExceptionHandler) +Failed asserting that false is true. +Test Finished (PHPUnit\TestFixture\Issue5592TestIsolation::testAddedExceptionHandler) +Child Process Finished +Child Process Started +Test Preparation Started (PHPUnit\TestFixture\Issue5592TestIsolation::testRemovedExceptionHandler) +Test Prepared (PHPUnit\TestFixture\Issue5592TestIsolation::testRemovedExceptionHandler) +Test Failed (PHPUnit\TestFixture\Issue5592TestIsolation::testRemovedExceptionHandler) +Failed asserting that false is true. +Test Finished (PHPUnit\TestFixture\Issue5592TestIsolation::testRemovedExceptionHandler) +Child Process Finished +Test Suite Finished (PHPUnit\TestFixture\Issue5592TestIsolation, 6 tests) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 1) From 185412d5a35b2b82a1bff2a767b09252e2b0b0c1 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Tue, 12 Aug 2025 13:00:42 +0200 Subject: [PATCH 2/2] use named exception handler --- .../regression/5592-process-isolation-events.phpt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/end-to-end/regression/5592-process-isolation-events.phpt b/tests/end-to-end/regression/5592-process-isolation-events.phpt index 3fcf21b265..f18e32dea0 100644 --- a/tests/end-to-end/regression/5592-process-isolation-events.phpt +++ b/tests/end-to-end/regression/5592-process-isolation-events.phpt @@ -8,7 +8,11 @@ $_SERVER['argv'][] = '--process-isolation'; $_SERVER['argv'][] = '--debug'; $_SERVER['argv'][] = __DIR__ . '/5592/Issue5592TestIsolation.php'; -set_exception_handler(static fn () => null); +function global5592IsolationEventsExceptionHandler(Throwable $exception): void +{ +} + +set_exception_handler('global5592IsolationEventsExceptionHandler'); require_once __DIR__ . '/../../bootstrap.php'; (new PHPUnit\TextUI\Application)->run($_SERVER['argv']);