Add a new Reader to be included
in the final results
public addReader ( ParaTest\Logging\JUnit\Reader $reader ) | ||
$reader | ParaTest\Logging\JUnit\Reader |
/** * Empty line attributes, e.g. line="" breaks Jenkins parsing since it needs to be an integer. * To repair, ensure that empty line attributes are actually written as 0 instead of empty string. */ public function testThatEmptyLineAttributesConvertToZero() { $mixed = FIXTURES . DS . 'results' . DS . 'junit-example-result.xml'; $reader = new Reader($mixed); $this->interpreter->addReader($reader); $writer = new Writer($this->interpreter, "test/fixtures/tests/"); $xml = $writer->getXml(); $this->assertFalse(strpos($xml, 'line=""'), 'Expected no empty line attributes (line=""), but found one.'); }
/** * Prints the individual "quick" feedback for run * tests, that is the ".EF" items * * @param ExecutableTest $test */ public function printFeedback(ExecutableTest $test) { $reader = new Reader($test->getTempFile()); $this->results->addReader($reader); $feedbackItems = $reader->getFeedback(); foreach ($feedbackItems as $item) { $this->printFeedbackItem($item); } }
/** * Prints the individual "quick" feedback for run * tests, that is the ".EF" items * * @param ExecutableTest $test */ public function printFeedback(ExecutableTest $test) { $reader = new Reader($test->getTempFile()); if (!$reader->hasResults()) { throw new \RuntimeException(sprintf("The process: %s\nLog file \"%s\" is empty.\n" . "This means a PHPUnit process was unable to run \"%s\"\n" . "Maybe there is more than one class in this file.", $test->getLastCommand(), $test->getTempFile(), $test->getPath())); } $this->results->addReader($reader); $this->processReaderFeedback($reader, $test->getTestCount()); $this->printTestWarnings($test); }
/** * Prints the individual "quick" feedback for run * tests, that is the ".EF" items * * @param ExecutableTest $test */ public function printFeedback(ExecutableTest $test) { $reader = new Reader($test->getTempFile()); if (!$reader->hasResults()) { throw new \RuntimeException("Log file " . $test->getTempFile() . " is empty.\n This means a PHPUnit process was unable to run " . $test->getPath() . "\n Maybe there is more than one class in this file."); } $this->results->addReader($reader); $feedbackItems = $reader->getFeedback(); $dataProviderOverhead = count($feedbackItems) - $test->getTestMethodCount(); $this->totalCases += $dataProviderOverhead; foreach ($feedbackItems as $item) { $this->printFeedbackItem($item); } $warnings = $test->getWarnings(); if ($warnings) { $this->addWarnings($warnings); foreach ($warnings as $warning) { $this->printFeedbackItem('W'); } } }
public function testGetCasesExtendEmptyCasesFromSuites() { $interpreter = new LogInterpreter(); $dataProviderReader = $this->getReader('dataProviderSuite'); $interpreter->addReader($dataProviderReader); $cases = $interpreter->getCases(); $this->assertEquals(10, count($cases)); foreach ($cases as $name => $case) { $this->assertAttributeNotEmpty('class', $case); $this->assertAttributeNotEmpty('file', $case); if ($case->name == "testNumericDataProvider5 with data set #3") { $this->assertEquals($case->class, 'DataProviderTest1'); } elseif ($case->name == "testNamedDataProvider5 with data set #3") { $this->assertEquals($case->class, 'DataProviderTest2'); } else { $this->assertEquals($case->class, 'DataProviderTest'); } if ($case->name == "testNumericDataProvider5 with data set #4") { $this->assertEquals($case->file, '/var/www/project/vendor/brianium/paratest/test/fixtures/dataprovider-tests/DataProviderTest1.php'); } elseif ($case->name == "testNamedDataProvider5 with data set #4") { $this->assertEquals($case->file, '/var/www/project/vendor/brianium/paratest/test/fixtures/dataprovider-tests/DataProviderTest2.php'); } else { $this->assertEquals($case->file, '/var/www/project/vendor/brianium/paratest/test/fixtures/dataprovider-tests/DataProviderTest.php'); } } }
public function testIsSuccessfulReturnsTrueIfNoErrorsOrFailures() { $interpreter = new LogInterpreter(); $interpreter->addReader($this->getReader('passingSuite')); $this->assertTrue($interpreter->isSuccessful()); }