Skip to content

Commit 41f4565

Browse files
committed
Wrap handler test in a try-finally
1 parent f7c69c2 commit 41f4565

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tests/Php85/Php85Test.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ class Php85Test extends TestCase
2121
public function testGetErrorHandler($expected, $handler): void
2222
{
2323
set_error_handler($handler);
24-
$result = get_error_handler();
25-
restore_error_handler();
26-
restore_error_handler();
24+
try {
25+
$result = get_error_handler();
26+
} finally {
27+
restore_error_handler();
28+
}
2729

2830
$this->assertSame($expected, $result);
2931
}
@@ -39,8 +41,11 @@ public function testErrorStableReturnValue(): void
3941
public function testGetExceptionHandler($expected, $handler): void
4042
{
4143
set_exception_handler($handler);
42-
$result = get_exception_handler();
43-
restore_exception_handler();
44+
try {
45+
$result = get_exception_handler();
46+
} finally {
47+
restore_error_handler();
48+
}
4449

4550
$this->assertSame($expected, $result);
4651
}

0 commit comments

Comments
 (0)