Skip to content

Commit

Permalink
Merge pull request #3309 from Icinga/bugfix/localfilestoragetest-erro…
Browse files Browse the repository at this point in the history
…r-handler

LocalFileStorageTest: restore error_reporting() level and error handler
  • Loading branch information
lippserd committed Jun 8, 2018
2 parents 23248a4 + a504281 commit f905a97
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/php/library/Icinga/File/Storage/LocalFileStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@

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) {
Expand All @@ -35,6 +41,12 @@ public function __construct($name = null, array $data = array(), $dataName = '')
});
}

public function __destruct()
{
error_reporting($this->oldErrorReportingLevel);
restore_error_handler();
}

public function testGetIterator()
{
$lfs = new TemporaryLocalFileStorage();
Expand Down

0 comments on commit f905a97

Please sign in to comment.