From e7ff0bdf661f2b2ebee386bc235a699b756d3e8a Mon Sep 17 00:00:00 2001 From: Mark Story Date: Sat, 8 May 2010 11:42:04 -0400 Subject: [PATCH] Adding missing parameters to assertEqual() wrapper. Adding assertNotEqual() wrapper. Adding expectError() but it doesn't work because of Debugger's error handler being set. Fixing fatal error where getDescription would not be defined. --- cake/tests/lib/cake_test_case.php | 15 +++++++++++++-- cake/tests/lib/reporter/cake_html_reporter.php | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cake/tests/lib/cake_test_case.php b/cake/tests/lib/cake_test_case.php index b242a184a..153668c10 100644 --- a/cake/tests/lib/cake_test_case.php +++ b/cake/tests/lib/cake_test_case.php @@ -386,8 +386,12 @@ class CakeTestCase extends PHPUnit_Framework_TestCase { } } - protected function assertEqual($a, $b) { - return $this->assertEquals($a, $b); + protected function assertEqual($a, $b, $message = '') { + return $this->assertEquals($a, $b, $message); + } + + protected function assertNotEqual($a, $b, $message = '') { + return $this->assertNotEquals($a, $b, $message); } protected function assertPattern($pattern, $string, $message = '') { @@ -404,6 +408,13 @@ class CakeTestCase extends PHPUnit_Framework_TestCase { protected function assertNoErrors() { } + + protected function expectError($expected = false, $message = '') { + if (!$expected) { + $expected = 'Exception'; + } + $this->setExpectedException($expected, $message); + } protected function expectException($name = null) { $this->setExpectedException($name); diff --git a/cake/tests/lib/reporter/cake_html_reporter.php b/cake/tests/lib/reporter/cake_html_reporter.php index 159541005..8380adf9e 100755 --- a/cake/tests/lib/reporter/cake_html_reporter.php +++ b/cake/tests/lib/reporter/cake_html_reporter.php @@ -257,7 +257,7 @@ class CakeHtmlReporter extends CakeBaseReporter implements PHPUnit_Framework_Tes echo "
  • \n"; echo "Failed"; - echo "
    " . $this->_htmlEntities($message->getDescription()) . "
    \n"; + echo "
    " . $this->_htmlEntities($message->toString()) . "
    \n"; echo "
    " . sprintf(__('File: %s'), $context['file']) . "
    \n"; echo "
    " . sprintf(__('Method: %s'), $realContext['function']) . "
    \n"; echo "
    " . sprintf(__('Line: %s'), $context['line']) . "
    \n";