mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Use the diff style provided by PHPUnit in the webrunner.
Displaying actual vs expected messages when the result is an array or string. Fixes #GH-699
This commit is contained in:
parent
76f93178a8
commit
7d93c57bd3
1 changed files with 14 additions and 1 deletions
|
@ -248,9 +248,22 @@ class CakeHtmlReporter extends CakeBaseReporter {
|
|||
$trace = $this->_getStackTrace($message);
|
||||
$testName = get_class($test) . '(' . $test->getName() . ')';
|
||||
|
||||
$failure = $message->getComparisonFailure();
|
||||
if (is_object($failure)) {
|
||||
$actualMsg = $message->getComparisonFailure()->getActualAsString();
|
||||
$expectedMsg = $message->getComparisonFailure()->getExpectedAsString();
|
||||
}
|
||||
|
||||
echo "<li class='fail'>\n";
|
||||
echo "<span>Failed</span>";
|
||||
echo "<div class='msg'><pre>" . $this->_htmlEntities($message->toString()) . "</pre></div>\n";
|
||||
echo "<div class='msg'><pre>" . $this->_htmlEntities($message->toString());
|
||||
|
||||
|
||||
if ((is_string($actualMsg) && is_string($expectedMsg)) || (is_array($actualMsg) && is_array($expectedMsg))) {
|
||||
echo "<br />" . PHPUnit_Util_Diff::diff($expectedMsg, $actualMsg);
|
||||
}
|
||||
|
||||
echo "</pre></div>\n";
|
||||
echo "<div class='msg'>" . __d('cake_dev', 'Test case: %s', $testName) . "</div>\n";
|
||||
echo "<div class='msg'>" . __d('cake_dev', 'Stack trace:') . '<br />' . $trace . "</div>\n";
|
||||
echo "</li>\n";
|
||||
|
|
Loading…
Reference in a new issue