tests: Removed exception handler registration because it has side effects
This commit is contained in:
parent
733586dfd5
commit
f5a7598a45
|
@ -27,9 +27,14 @@ class Handler
|
|||
|
||||
/**
|
||||
* Activate the error handler
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
if (defined('PHPUNIT_COMPOSER_INSTALL')) {
|
||||
return;
|
||||
}
|
||||
|
||||
set_error_handler([$this, 'errorHandler']);
|
||||
set_exception_handler([$this, 'exceptionHandler']);
|
||||
}
|
||||
|
|
|
@ -80,25 +80,6 @@ class HandlerTest extends TestCase
|
|||
$this->assertEquals($errorMessage, $return);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Exceptions\Handler::register()
|
||||
*/
|
||||
public function testRegister(): void
|
||||
{
|
||||
/** @var Handler|MockObject $handler */
|
||||
$handler = $this->getMockForAbstractClass(Handler::class);
|
||||
$handler->register();
|
||||
|
||||
set_error_handler($errorHandler = set_error_handler('var_dump'));
|
||||
$this->assertEquals($handler, array_shift($errorHandler));
|
||||
|
||||
set_exception_handler($exceptionHandler = set_error_handler('var_dump'));
|
||||
$this->assertEquals($handler, array_shift($exceptionHandler));
|
||||
|
||||
restore_error_handler();
|
||||
restore_exception_handler();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Exceptions\Handler::getEnvironment()
|
||||
* @covers \Engelsystem\Exceptions\Handler::setEnvironment()
|
||||
|
|
Loading…
Reference in New Issue