diff --git a/tests/bootstrap.php b/tests/bootstrap.php index c347ebe..3a096b6 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -14,4 +14,15 @@ Environment::setup(); Environment::bypassFinals(); +# disable E_DEPRECATED errors from the vendor code (some nette packages before v3.1 are not fully compatible with PHP 8.1/8.2) +$previousHandler = set_error_handler(static function (int $errNo, string $errStr, string $errFile, int $errLine) use (&$previousHandler): bool { + $vendor = realpath(__DIR__ . '/../vendor'); + + if (E_DEPRECATED === $errNo && 0 === strncmp($errFile, $vendor, strlen($vendor))) { + return true; + } + + return $previousHandler($errNo, $errStr, $errFile, $errLine); +}); + return $loader;