Improve failed test output; fix typo.

This commit is contained in:
Dave Longley 2013-09-14 21:08:40 -04:00
parent 77dc82bdb5
commit d85c25bdb3

View file

@ -222,7 +222,8 @@ class JsonLdTest {
$data, '@type', 'jld:NegativeEvaluationTest'); $data, '@type', 'jld:NegativeEvaluationTest');
// generate test name // generate test name
$this->name = $manifest->data->name . ' ' . substr($data->{'@id'}, 2); $this->name = $manifest->data->name . ' ' . substr($data->{'@id'}, 2) .
' - ' . $this->data->name;
// expand @id and input base // expand @id and input base
$data->{'@id'} = ($manifest->data->baseIri . $data->{'@id'} = ($manifest->data->baseIri .
@ -319,7 +320,7 @@ class JsonLdTest {
$content_type = (property_exists($options, 'contentType') ? $content_type = (property_exists($options, 'contentType') ?
$options->contentType : null); $options->contentType : null);
$extension = pathinfo($url, PATHINFO_EXTENSION); $extension = pathinfo($url, PATHINFO_EXTENSION);
if(!$content_type && $extension === '.jsonld') { if(!$content_type && $extension === 'jsonld') {
$content_type = 'application/ld+json'; $content_type = 'application/ld+json';
} }
$link_header = $options->httpLink; $link_header = $options->httpLink;
@ -546,7 +547,9 @@ class EarlReport implements PHPUnit_Framework_TestListener {
PHPUnit_Framework_AssertionFailedError $e, $time) { PHPUnit_Framework_AssertionFailedError $e, $time) {
$this->addAssertion($test->test, false); $this->addAssertion($test->test, false);
if($this->result->shouldStop()) { if($this->result->shouldStop()) {
printf("\nFAILED Test: %s\n", $test->test->name); printf("\n\nFAILED\n");
printf("Test: %s\n", $test->test->name);
printf("Purpose: %s\n", $test->test->data->purpose);
printf("EXPECTED: %s\n", Util::jsonldEncode($test->test->expected)); printf("EXPECTED: %s\n", Util::jsonldEncode($test->test->expected));
printf("ACTUAL: %s\n", Util::jsonldEncode($test->test->actual)); printf("ACTUAL: %s\n", Util::jsonldEncode($test->test->actual));
exit(0); exit(0);
@ -559,10 +562,7 @@ class EarlReport implements PHPUnit_Framework_TestListener {
} }
public function addSkippedTest( public function addSkippedTest(
PHPUnit_Framework_Test $test, Exception $e, $time) { PHPUnit_Framework_Test $test, Exception $e, $time) {}
printf("Test '%s' has been skipped.\n", $test->test->data->{'@id'});
}
public function startTest(PHPUnit_Framework_Test $test) {} public function startTest(PHPUnit_Framework_Test $test) {}
public function startTestSuite(PHPUnit_Framework_TestSuite $suite) {} public function startTestSuite(PHPUnit_Framework_TestSuite $suite) {}
public function endTestSuite(PHPUnit_Framework_TestSuite $suite) {} public function endTestSuite(PHPUnit_Framework_TestSuite $suite) {}