Merge pull request #3309 from Icinga/bugfix/localfilestoragetest-error-handler

LocalFileStorageTest: restore error_reporting() level and error handler
This commit is contained in:
Eric Lippmann 2018-06-08 09:03:31 -04:00 committed by GitHub
commit f905a978d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,10 +11,16 @@ use Icinga\Test\BaseTestCase;
class LocalFileStorageTest extends BaseTestCase class LocalFileStorageTest extends BaseTestCase
{ {
/**
* @var int
*/
protected $oldErrorReportingLevel;
public function __construct($name = null, array $data = array(), $dataName = '') public function __construct($name = null, array $data = array(), $dataName = '')
{ {
parent::__construct($name, $data, $dataName); parent::__construct($name, $data, $dataName);
$this->oldErrorReportingLevel = error_reporting();
error_reporting(E_ALL | E_STRICT); error_reporting(E_ALL | E_STRICT);
set_error_handler(function ($errno, $errstr, $errfile, $errline) { set_error_handler(function ($errno, $errstr, $errfile, $errline) {
@ -35,6 +41,12 @@ class LocalFileStorageTest extends BaseTestCase
}); });
} }
public function __destruct()
{
error_reporting($this->oldErrorReportingLevel);
restore_error_handler();
}
public function testGetIterator() public function testGetIterator()
{ {
$lfs = new TemporaryLocalFileStorage(); $lfs = new TemporaryLocalFileStorage();