Skip to content

Commit

Permalink
Separated test since PHP 7 behaves differently
Browse files Browse the repository at this point in the history
PHPUnit does not catch BaseException yet (introduced in PHP 7), so adding a separated test to verify it
  • Loading branch information
jrbasso committed Mar 29, 2015
1 parent 57bcf5e commit 30bf826
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions tests/TestCase/Auth/ControllerAuthorizeTest.php
Expand Up @@ -46,12 +46,28 @@ public function setUp()
}

/**
* @expectedException \PHPUnit_Framework_Error
* @return void
*/
public function testControllerTypeError()
{
$this->auth->controller(new \StdClass());
$this->skipIf(PHP_VERSION_ID >= 70000);

$this->setExpectedException('PHPUnit_Framework_Error');
$this->auth->controller(new \stdClass());
}

/**
* @return void
*/
public function testControllerTypeErrorPhp7()
{
$this->skipIf(PHP_VERSION_ID < 70000);

try {
$this->auth->controller(new \stdClass());
} catch (\BaseException $e) {
$this->assertTrue(true);
}
}

/**
Expand Down

0 comments on commit 30bf826

Please sign in to comment.