Skip to content

Commit

Permalink
Adding missing parameters to assertEqual() wrapper.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
markstory committed May 8, 2010
1 parent 82a1bd6 commit e7ff0bd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions cake/tests/lib/cake_test_case.php
Expand Up @@ -386,8 +386,12 @@ private function __array_permute($items, $perms = array()) {
}
}

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 = '') {
Expand All @@ -404,6 +408,13 @@ protected function assertNoPattern($pattern, $string, $message = '') {

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);
Expand Down
2 changes: 1 addition & 1 deletion cake/tests/lib/reporter/cake_html_reporter.php
Expand Up @@ -257,7 +257,7 @@ public function paintFail($message) {

echo "<li class='fail'>\n";
echo "<span>Failed</span>";
echo "<div class='msg'><pre>" . $this->_htmlEntities($message->getDescription()) . "</pre></div>\n";
echo "<div class='msg'><pre>" . $this->_htmlEntities($message->toString()) . "</pre></div>\n";
echo "<div class='msg'>" . sprintf(__('File: %s'), $context['file']) . "</div>\n";
echo "<div class='msg'>" . sprintf(__('Method: %s'), $realContext['function']) . "</div>\n";
echo "<div class='msg'>" . sprintf(__('Line: %s'), $context['line']) . "</div>\n";
Expand Down

0 comments on commit e7ff0bd

Please sign in to comment.