Skip to content

Commit

Permalink
Adding compatibility assert methods for CakeTestCase to ease the tran…
Browse files Browse the repository at this point in the history
…sition to PHPUnit
  • Loading branch information
lorenzo committed May 4, 2010
1 parent 7417a00 commit 14559aa
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions cake/tests/lib/cake_test_case.php
Expand Up @@ -82,7 +82,7 @@ protected function _invoke(&$controller, $params, $missingAction = false) {
* @package cake
* @subpackage cake.cake.tests.lib
*/
class CakeTestCase extends UnitTestCase {
class CakeTestCase extends PHPUnit_Framework_TestCase {

/**
* Methods used internally.
Expand Down Expand Up @@ -191,8 +191,10 @@ public function assert(&$expectation, $compare, $message = '%s') {
* @param string $message
* @return boolean
*/
public function skipIf($shouldSkip, $message = '%s') {
parent::skipIf($shouldSkip, $message);
public function skipIf($shouldSkip, $message = '') {
if ($shouldSkip) {
$this->markTestSkipped($message);
}
return $shouldSkip;
}

Expand Down Expand Up @@ -298,7 +300,7 @@ public function endController(&$controller, $params = array()) {
* @param mixed $params Parameters (see above), or simply a string of what to return
* @return mixed Whatever is returned depending of requested result
*/
public function testAction($url, $params = array()) {
public function runTestAction($url, $params = array()) {
$default = array(
'return' => 'result',
'fixturize' => false,
Expand Down Expand Up @@ -685,7 +687,7 @@ public function assertTags($string, $expected, $fullDebug = false) {
return false;
}
}
return $this->assert(new TrueExpectation(), true, '%s');
return $this->assertTrue(true, '%s');
}

/**
Expand Down Expand Up @@ -817,5 +819,28 @@ private function __array_permute($items, $perms = array()) {
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);
}
}
?>

0 comments on commit 14559aa

Please sign in to comment.