fix(AppTest): add error handlers on exit
This commit is contained in:
parent
1f89a43499
commit
d4711dddd1
@ -16,6 +16,33 @@ use Throwable;
|
|||||||
final class AppTest extends TestCase {
|
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
|
* @dataProvider apiRewriteProvider
|
||||||
* @covers App::update_SERVERIfNeeded
|
* @covers App::update_SERVERIfNeeded
|
||||||
* @param string $rootFolder,
|
* @param string $rootFolder,
|
||||||
@ -62,7 +89,7 @@ final class AppTest extends TestCase {
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prepareData(
|
protected function prepareData(
|
||||||
array &$data,
|
array &$data,
|
||||||
string $name,
|
string $name,
|
||||||
string $rootFolder,
|
string $rootFolder,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user