Skip to content

Commit 6c76c33

Browse files
staabmsebastianbergmann
authored andcommitted
Added more detailed assertions in Issue5592Test
1 parent fc44414 commit 6c76c33

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ Test code or tested code removed error handlers other than its own
5252
%sIssue5592Test.php:%i
5353

5454
FAILURES!
55-
Tests: 6, Assertions: 6, Failures: 4, Risky: 1.
55+
Tests: 6, Assertions: 10, Failures: 4, Risky: 1.

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

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,25 @@
1414
use function set_error_handler;
1515
use function set_exception_handler;
1616
use PHPUnit\Framework\TestCase;
17+
use PHPUnit\Runner\ErrorHandler;
18+
use Throwable;
1719

1820
class Issue5592Test extends TestCase
1921
{
2022
public function testAddedAndRemovedErrorHandler(): void
2123
{
22-
set_error_handler(static fn () => false);
24+
$previous = set_error_handler([$this, 'addedAndRemovedErrorHandler']);
2325
restore_error_handler();
26+
27+
$this->assertInstanceOf(ErrorHandler::class, $previous);
2428
$this->assertTrue(true);
2529
}
2630

2731
public function testAddedErrorHandler(): void
2832
{
29-
set_error_handler(static fn () => false);
33+
$previous = set_error_handler([$this, 'addedErrorHandler']);
34+
35+
$this->assertInstanceOf(ErrorHandler::class, $previous);
3036
$this->assertTrue(false);
3137
}
3238

@@ -38,14 +44,18 @@ public function testRemovedErrorHandler(): void
3844

3945
public function testAddedAndRemovedExceptionHandler(): void
4046
{
41-
set_exception_handler(static fn () => null);
47+
$previous = set_exception_handler([$this, 'addedAndRemovedExceptionHandler']);
4248
restore_exception_handler();
49+
50+
$this->assertNull($previous);
4351
$this->assertTrue(true);
4452
}
4553

4654
public function testAddedExceptionHandler(): void
4755
{
48-
set_exception_handler(static fn () => null);
56+
$previous = set_exception_handler([$this, 'addedExceptionHandler']);
57+
58+
$this->assertNull($previous);
4959
$this->assertTrue(false);
5060
}
5161

@@ -54,4 +64,20 @@ public function testRemovedExceptionHandler(): void
5464
restore_exception_handler();
5565
$this->assertTrue(false);
5666
}
67+
68+
public function addedAndRemovedErrorHandler($errno, $errstr, $errfile, $errline): void
69+
{
70+
}
71+
72+
public function addedErrorHandler($errno, $errstr, $errfile, $errline): void
73+
{
74+
}
75+
76+
public function addedAndRemovedExceptionHandler(Throwable $exception): void
77+
{
78+
}
79+
80+
public function addedExceptionHandler(Throwable $exception): void
81+
{
82+
}
5783
}

0 commit comments

Comments
 (0)