Inheritance: extends ParaTest\Logging\MetaProvider
Example #1
0
 /**
  * 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.');
 }
Example #2
0
 /**
  * Returns the xml structure the writer
  * will use
  *
  * @return string
  */
 public function getXml()
 {
     $suites = $this->interpreter->flattenCases();
     $root = $this->getSuiteRoot($suites);
     foreach ($suites as $suite) {
         $snode = $this->appendSuite($root, $suite);
         foreach ($suite->cases as $case) {
             $cnode = $this->appendCase($snode, $case);
         }
     }
     return $this->document->saveXML();
 }
Example #3
0
 /**
  * Finalizes the run process. This method
  * prints all results, rewinds the log interpreter,
  * logs any results to JUnit, and cleans up temporary
  * files
  */
 private function complete()
 {
     $this->printer->printResults();
     $this->interpreter->rewind();
     $this->log();
     $this->logCoverage();
     $readers = $this->interpreter->getReaders();
     foreach ($readers as $reader) {
         $reader->removeLog();
     }
 }
Example #4
0
 /**
  * Get the footer for a test collection containing all successful
  * tests
  *
  * @return string
  */
 private function getSuccessFooter()
 {
     $tests = $this->totalCases;
     $asserts = $this->results->getTotalAssertions();
     if ($this->totalSkippedOrIncomplete > 0) {
         // phpunit 4.5 produce NOT plural version for test(s) and assertion(s) in that case
         // also it shows result in standard color scheme
         return sprintf("OK, but incomplete, skipped, or risky tests!\n" . "Tests: %d, Assertions: %d, Incomplete: %d.\n", $tests, $asserts, $this->totalSkippedOrIncomplete);
     } else {
         // phpunit 4.5 produce plural version for test(s) and assertion(s) in that case
         // also it shows result as black text on green background
         return $this->green(sprintf("OK (%d test%s, %d assertion%s)\n", $tests, $tests == 1 ? '' : 's', $asserts, $asserts == 1 ? '' : 's'));
     }
 }
Example #5
0
 /**
  * Get the footer for a test collection containing all successful
  * tests
  *
  * @return string
  */
 private function getSuccessFooter()
 {
     $tests = $this->results->getTotalTests();
     $asserts = $this->results->getTotalAssertions();
     return $this->green(sprintf("OK (%d test%s, %d assertion%s)\n", $tests, $tests == 1 ? '' : 's', $asserts, $asserts == 1 ? '' : 's'));
 }
 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());
 }