LocalFileStorageTest: restore error_reporting() level and error handler

... not to cause side effects in other tests
This commit is contained in:
Alexander A. Klimov 2017-12-05 11:48:17 +01:00
parent 7f5962dfae
commit a504281248
1 changed files with 12 additions and 0 deletions

View File

@ -11,10 +11,16 @@ use Icinga\Test\BaseTestCase;
class LocalFileStorageTest extends BaseTestCase
{
/**
* @var int
*/
protected $oldErrorReportingLevel;
public function __construct($name = null, array $data = array(), $dataName = '')
{
parent::__construct($name, $data, $dataName);
$this->oldErrorReportingLevel = error_reporting();
error_reporting(E_ALL | E_STRICT);
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()
{
$lfs = new TemporaryLocalFileStorage();