Skip to content

Commit

Permalink
remove error_reporting() handling/use deprecated()
Browse files Browse the repository at this point in the history
remove error_reporting() from

setUpBeforeClass()
tearDownAfterClass()
tearDown()

+
used deprecated() helper
  • Loading branch information
saeideng committed Oct 10, 2017
1 parent 5c8ed03 commit a834bc4
Showing 1 changed file with 4 additions and 32 deletions.
36 changes: 4 additions & 32 deletions tests/TestCase/Controller/ControllerTest.php
Expand Up @@ -236,12 +236,6 @@ class ControllerTest extends TestCase
'core.posts'
];

/**
* error level property
*
*/
private static $errorLevel;

/**
* reset environment.
*
Expand All @@ -264,29 +258,6 @@ public function tearDown()
{
parent::tearDown();
Plugin::unload();
error_reporting(self::$errorLevel);
}

/**
* setUpBeforeClass
*
* @return void
*/
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
self::$errorLevel = error_reporting();
}

/**
* tearDownAfterClass
*
* @return void
*/
public static function tearDownAfterClass()
{
parent::tearDownAfterClass();
error_reporting(self::$errorLevel);
}

/**
Expand Down Expand Up @@ -1128,9 +1099,10 @@ public function testBeforeRenderViewVariables()
public function testDeprecatedViewProperty($property, $getter, $setter, $value)
{
$controller = new AnotherTestController();
error_reporting(E_ALL ^ E_USER_DEPRECATED);
$controller->$property = $value;
$this->assertSame($value, $controller->$property);
$this->deprecated(function () use ($controller, $property, $value) {
$controller->$property = $value;
$this->assertSame($value, $controller->$property);
});
$this->assertSame($value, $controller->viewBuilder()->{$getter}());
}

Expand Down

0 comments on commit a834bc4

Please sign in to comment.