mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Adding compatibility assert methods for CakeTestCase to ease the transition to PHPUnit
This commit is contained in:
parent
7417a00de7
commit
14559aabd9
1 changed files with 30 additions and 5 deletions
|
@ -82,7 +82,7 @@ class CakeTestDispatcher extends Dispatcher {
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.tests.lib
|
* @subpackage cake.cake.tests.lib
|
||||||
*/
|
*/
|
||||||
class CakeTestCase extends UnitTestCase {
|
class CakeTestCase extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methods used internally.
|
* Methods used internally.
|
||||||
|
@ -191,8 +191,10 @@ class CakeTestCase extends UnitTestCase {
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function skipIf($shouldSkip, $message = '%s') {
|
public function skipIf($shouldSkip, $message = '') {
|
||||||
parent::skipIf($shouldSkip, $message);
|
if ($shouldSkip) {
|
||||||
|
$this->markTestSkipped($message);
|
||||||
|
}
|
||||||
return $shouldSkip;
|
return $shouldSkip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,7 +300,7 @@ class CakeTestCase extends UnitTestCase {
|
||||||
* @param mixed $params Parameters (see above), or simply a string of what to return
|
* @param mixed $params Parameters (see above), or simply a string of what to return
|
||||||
* @return mixed Whatever is returned depending of requested result
|
* @return mixed Whatever is returned depending of requested result
|
||||||
*/
|
*/
|
||||||
public function testAction($url, $params = array()) {
|
public function runTestAction($url, $params = array()) {
|
||||||
$default = array(
|
$default = array(
|
||||||
'return' => 'result',
|
'return' => 'result',
|
||||||
'fixturize' => false,
|
'fixturize' => false,
|
||||||
|
@ -685,7 +687,7 @@ class CakeTestCase extends UnitTestCase {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->assert(new TrueExpectation(), true, '%s');
|
return $this->assertTrue(true, '%s');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -817,5 +819,28 @@ class CakeTestCase extends UnitTestCase {
|
||||||
return $permuted;
|
return $permuted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function assertEqual($a, $b) {
|
||||||
|
return $this->assertEquals($a, $b);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function assertPattern($pattern, $string, $message = '') {
|
||||||
|
return $this->assertRegExp($pattern, $string, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function assertIdentical($expected, $actual, $message = '') {
|
||||||
|
return $this->assertSame($expected, $actual, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function assertNoPattern($pattern, $string, $message = '') {
|
||||||
|
return $this->assertNotRegExp($pattern, $string, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function assertNoErrors() {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function expectException($name = null) {
|
||||||
|
$this->setExpectedException($name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue