Skip to content

Commit 990a2bf

Browse files
committed
fix unit test custom error handler
1 parent 987fc5d commit 990a2bf

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

src/ErrorHandler/AbstractError.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ private function valIsSuppressed()
360360
$errorReporting = \error_reporting();
361361
// @see https://php.watch/versions/8.0/fatal-error-suppression
362362
$php8suppressValue = E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE;
363-
return $errorReporting === 0
363+
return !(\error_reporting() & $this->values['type'])
364364
|| (PHP_VERSION_ID >= 80000 && $errorReporting === $php8suppressValue && $errorReporting < $this->subject->get('errorReportingInitial'));
365365
}
366366
}

tests/Debug/DebugTestFramework.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ public static function setUpBeforeClass(): void
173173
*/
174174

175175
self::$errorHandlerPrev = \set_error_handler(static function ($errno, $errstr, $errfile, $errline) {
176+
if (!(\error_reporting() & $errno)) {
177+
// suppressed
178+
return true;
179+
}
180+
176181
$dirVendor = \realpath(__DIR__ . '/../../vendor');
177182
if (
178183
$errno === E_DEPRECATED

tests/Debug/Type/BasicTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -669,14 +669,6 @@ public static function providerTestMethod()
669669
),
670670
);
671671

672-
// phpunit issue with php 8.5 causing INF and NAN tests to fail
673-
if (PHP_VERSION_ID >= 80500) {
674-
$tests = \array_diff_key($tests, \array_flip(array(
675-
'float.inf',
676-
'float.NaN',
677-
)));
678-
}
679-
680672
return \array_map(static function ($test) {
681673
return \is_callable($test)
682674
? $test()

0 commit comments

Comments
 (0)