Skip to content

Commit 5431254

Browse files
staabmsebastianbergmann
authored andcommitted
use named global exception handler to make test more obvious
1 parent f8382c9 commit 5431254

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

tests/end-to-end/regression/5592-process-isolation.phpt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ $_SERVER['argv'][] = '--no-configuration';
77
$_SERVER['argv'][] = '--process-isolation';
88
$_SERVER['argv'][] = __DIR__ . '/5592/Issue5592TestIsolation.php';
99

10-
set_exception_handler(static fn () => null);
10+
function global5592IsolationExceptionHandler(Throwable $exception): void
11+
{
12+
}
13+
14+
set_exception_handler('global5592IsolationExceptionHandler');
1115

1216
require_once __DIR__ . '/../../bootstrap.php';
1317
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);

tests/end-to-end/regression/5592.phpt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ $_SERVER['argv'][] = '--do-not-cache-result';
66
$_SERVER['argv'][] = '--no-configuration';
77
$_SERVER['argv'][] = __DIR__ . '/5592/Issue5592Test.php';
88

9-
set_exception_handler(static fn () => null);
9+
function global5592ExceptionHandler(Throwable $exception): void
10+
{
11+
}
12+
13+
set_exception_handler('global5592ExceptionHandler');
1014

1115
require_once __DIR__ . '/../../bootstrap.php';
1216
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);

tests/end-to-end/regression/5592/Issue5592Test.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use function restore_exception_handler;
1414
use function set_error_handler;
1515
use function set_exception_handler;
16-
use Closure;
1716
use PHPUnit\Framework\TestCase;
1817
use PHPUnit\Runner\ErrorHandler;
1918
use Throwable;
@@ -48,15 +47,15 @@ public function testAddedAndRemovedExceptionHandler(): void
4847
$previous = set_exception_handler([$this, 'addedAndRemovedExceptionHandler']);
4948
restore_exception_handler();
5049

51-
$this->assertInstanceOf(Closure::class, $previous);
50+
$this->assertSame('global5592ExceptionHandler', $previous);
5251
$this->assertTrue(true);
5352
}
5453

5554
public function testAddedExceptionHandler(): void
5655
{
5756
$previous = set_exception_handler([$this, 'addedExceptionHandler']);
5857

59-
$this->assertInstanceOf(Closure::class, $previous);
58+
$this->assertSame('global5592ExceptionHandler', $previous);
6059
$this->assertTrue(false);
6160
}
6261

0 commit comments

Comments
 (0)