diff --git a/tests/AppTest.php b/tests/AppTest.php index 61d7091..bc875e6 100644 --- a/tests/AppTest.php +++ b/tests/AppTest.php @@ -16,6 +16,33 @@ use Throwable; final class AppTest extends TestCase { /** + * register error handlers + */ + public function testInit() + { + $displayErrors = true; + set_error_handler(function( + int $errno, + string $errstr, + ?string $errfile = null, + ?int $errline = null, + ?array $errcontext = null + ) use (&$displayErrors){ + if ($displayErrors){ + echo "\nError $errstr ($errno)\nIn file $errfile\nLine : $errline\n"; + } + }); + register_shutdown_function(function (){ + $lastErr = error_get_last(); + if (!is_null($lastErr)){ + echo "\nAn error occured\n".json_encode($lastErr)."\n"; + } + }); + $this->assertTrue($displayErrors); + } + + /** + * @depends testInit * @dataProvider apiRewriteProvider * @covers App::update_SERVERIfNeeded * @param string $rootFolder, @@ -62,7 +89,7 @@ final class AppTest extends TestCase { return $data; } - public function prepareData( + protected function prepareData( array &$data, string $name, string $rootFolder,