Skip to content
Permalink
Browse files

Making sure the tests on PHP7 are testing the expected message and fa…

…iling if no exception is thrown
  • Loading branch information...
jrbasso committed Mar 29, 2015
1 parent 29be1fe commit f5930c0f0d97d5061ee5ef1035a33010cb49b506
Showing with 10 additions and 4 deletions.
  1. +5 −2 tests/TestCase/Auth/ControllerAuthorizeTest.php
  2. +5 −2 tests/TestCase/Core/ConfigureTest.php
@@ -52,7 +52,8 @@ public function testControllerTypeError()
{
$this->skipIf(PHP_VERSION_ID >= 70000);
$this->setExpectedException('PHPUnit_Framework_Error');
$message = '/^Argument 1 passed to Cake\\\Auth\\\ControllerAuthorize::controller\(\) must be an instance of Cake\\\Controller\\\Controller, instance of stdClass given.*/';
$this->setExpectedExceptionRegExp('PHPUnit_Framework_Error', $message);
$this->auth->controller(new \stdClass());
}
@@ -65,8 +66,10 @@ public function testControllerTypeErrorPhp7()
try {
$this->auth->controller(new \stdClass());
$this->fail();
} catch (\BaseException $e) {
$this->assertTrue(true);
$expectedMessage = 'Argument 1 passed to Cake\Auth\ControllerAuthorize::controller() must be an instance of Cake\Controller\Controller, instance of stdClass given';
$this->assertContains($expectedMessage, $e->getMessage());
}
}
@@ -469,7 +469,8 @@ public function testEngineExceptionOnIncorrectClass()
{
$this->skipIf(PHP_VERSION_ID >= 70000);
$this->setExpectedException('PHPUnit_Framework_Error');
$message = '/^Argument 2 passed to Cake\\\Core\\\Configure::config\(\) must implement interface Cake\\\Core\\\Configure\\\ConfigEngineInterface, instance of stdClass given.*/';
$this->setExpectedExceptionRegExp('PHPUnit_Framework_Error', $message);
Configure::config('test', new \stdClass());
}
@@ -484,8 +485,10 @@ public function testEngineExceptionOnIncorrectClassPhp7()
try {
Configure::config('test', new \stdClass());
$this->fail();
} catch (\BaseException $e) {
$this->assertTrue(true);
$expectedMessage = 'Argument 2 passed to Cake\Core\Configure::config() must implement interface Cake\Core\Configure\ConfigEngineInterface, instance of stdClass given';
$this->assertContains($expectedMessage, $e->getMessage());
}
}

0 comments on commit f5930c0

Please sign in to comment.
You can’t perform that action at this time.