mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Include full traces in unit test failures, for easier debugging
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60605 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
ec96a10a20
commit
300dfa9d07
@ -34,6 +34,8 @@ class CliTestReporter extends SapphireTestReporter {
|
|||||||
if ($test['status'] != 1) {
|
if ($test['status'] != 1) {
|
||||||
echo $this->testNameToPhrase($test['name']) . "\n". $test['message'] . "\n";
|
echo $this->testNameToPhrase($test['name']) . "\n". $test['message'] . "\n";
|
||||||
echo "In line {$test['exception']['line']} of {$test['exception']['file']}" . "\n\n";
|
echo "In line {$test['exception']['line']} of {$test['exception']['file']}" . "\n\n";
|
||||||
|
echo Debug::get_rendered_backtrace($test['trace'], true);
|
||||||
|
echo "\n--------------------\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,6 +152,7 @@ class SapphireTestReporter implements PHPUnit_Framework_TestListener {
|
|||||||
$this->currentTest['status'] = TEST_FAILURE;
|
$this->currentTest['status'] = TEST_FAILURE;
|
||||||
$this->currentTest['message'] = $e->toString();
|
$this->currentTest['message'] = $e->toString();
|
||||||
$this->currentTest['exception'] = $this->getTestException($test, $e);
|
$this->currentTest['exception'] = $this->getTestException($test, $e);
|
||||||
|
$this->currentTest['trace'] = $e->getTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -168,6 +169,7 @@ class SapphireTestReporter implements PHPUnit_Framework_TestListener {
|
|||||||
$this->currentTest['status'] = TEST_ERROR;
|
$this->currentTest['status'] = TEST_ERROR;
|
||||||
$this->currentTest['message'] = $e->getMessage();
|
$this->currentTest['message'] = $e->getMessage();
|
||||||
$this->currentTest['exception'] = $this->getTestException($test, $e);
|
$this->currentTest['exception'] = $this->getTestException($test, $e);
|
||||||
|
$this->currentTest['trace'] = $e->getTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -184,6 +186,7 @@ class SapphireTestReporter implements PHPUnit_Framework_TestListener {
|
|||||||
$this->currentTest['status'] = TEST_INCOMPLETE;
|
$this->currentTest['status'] = TEST_INCOMPLETE;
|
||||||
$this->currentTest['message'] = $e->toString();
|
$this->currentTest['message'] = $e->toString();
|
||||||
$this->currentTest['exception'] = $this->getTestException($test, $e);
|
$this->currentTest['exception'] = $this->getTestException($test, $e);
|
||||||
|
$this->currentTest['trace'] = $e->getTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -266,7 +269,8 @@ class SapphireTestReporter implements PHPUnit_Framework_TestListener {
|
|||||||
if ($test['status'] != 1) {
|
if ($test['status'] != 1) {
|
||||||
echo "<div class=\"failure\"><span>⊗ ". $this->testNameToPhrase($test['name']) ."</span><br>";
|
echo "<div class=\"failure\"><span>⊗ ". $this->testNameToPhrase($test['name']) ."</span><br>";
|
||||||
echo "<pre>".htmlentities($test['message'])."</pre><br>";
|
echo "<pre>".htmlentities($test['message'])."</pre><br>";
|
||||||
echo "<code>In line {$test['exception']['line']} of {$test['exception']['file']}</code></div>";
|
echo Debug::get_rendered_backtrace($test['trace']);
|
||||||
|
echo "</div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user