skipped() public method

Returns an Enumeration for the skipped tests.
public skipped ( ) : array
return array
Beispiel #1
0
 /**
  * Creates a Streamwide_PHPUnit_Runner_TestCaseResult from a PHPUnit_Framework_TestResult.
  *
  * @param Streamwide_PHPUnit_Runner_TestCase    $testCase   test case
  * @param PHPUnit_Framework_TestResult $testResult test result
  * @return Streamwide_PHPUnit_Runner_TestCaseResult test case result
  */
 public static function fromPHPUnitTestResult(Streamwide_PHPUnit_Runner_TestCase $testCase, PHPUnit_Framework_TestResult $testResult)
 {
     $passed = $testResult->passed();
     $skipped = $testResult->skipped();
     $errors = $testResult->errors();
     $failures = $testResult->failures();
     $notImplemented = $testResult->notImplemented();
     $time = $testResult->time();
     $statusMessage = null;
     $codeCoverage = null;
     if (!empty($passed)) {
         $status = Streamwide_PHPUnit_Runner_TestCaseResult::PASSED;
         $codeCoverage = $testResult->getCodeCoverageInformation();
     } else {
         if (!empty($skipped)) {
             $status = Streamwide_PHPUnit_Runner_TestCaseResult::SKIPPED;
             $statusMessage = $skipped[0]->toStringVerbose(true);
         } else {
             if (!empty($notImplemented)) {
                 $status = Streamwide_PHPUnit_Runner_TestCaseResult::NOT_IMPLEMENTED;
                 $statusMessage = $notImplemented[0]->toStringVerbose(true);
             } else {
                 if (!empty($errors)) {
                     $status = Streamwide_PHPUnit_Runner_TestCaseResult::ERROR;
                     $statusMessage = $errors[0]->toStringVerbose(true) . PHPUnit_Util_Filter::getFilteredStacktrace($errors[0]->thrownException());
                 } else {
                     if (!empty($failures)) {
                         $status = Streamwide_PHPUnit_Runner_TestCaseResult::FAILED;
                         $statusMessage = $failures[0]->toStringVerbose(true) . PHPUnit_Util_Filter::getFilteredStacktrace($failures[0]->thrownException());
                     }
                 }
             }
         }
     }
     $testCaseResult = new Streamwide_PHPUnit_Runner_TestCaseResult($testCase, $status, $statusMessage, null, $time, $codeCoverage);
     return $testCaseResult;
 }
Beispiel #2
0
 /**
  * @param  PHPUnit_Framework_Test       $test
  * @param  PHPUnit_Framework_TestResult $result
  * @return mixed
  */
 public static function lookupResult(PHPUnit_Framework_Test $test, PHPUnit_Framework_TestResult $result)
 {
     $testName = self::describe($test);
     foreach ($result->errors() as $error) {
         if ($testName == self::describe($error->failedTest())) {
             return $error;
         }
     }
     foreach ($result->failures() as $failure) {
         if ($testName == self::describe($failure->failedTest())) {
             return $failure;
         }
     }
     foreach ($result->notImplemented() as $notImplemented) {
         if ($testName == self::describe($notImplemented->failedTest())) {
             return $notImplemented;
         }
     }
     foreach ($result->skipped() as $skipped) {
         if ($testName == self::describe($skipped->failedTest())) {
             return $skipped;
         }
     }
     return PHPUnit_Runner_BaseTestRunner::STATUS_PASSED;
 }
Beispiel #3
0
 /**
  * @param  PHPUnit_Framework_TestResult  $result
  * @since  Method available since Release 3.0.0
  */
 protected function printSkipped(PHPUnit_Framework_TestResult $result)
 {
     $this->printDefects($result->skipped(), $result->skippedCount(), 'skipped test');
 }
Beispiel #4
0
 /**
  * Parse the test suite result
  *
  * @param \PHPUnit_Framework_TestResult $result
  * @return array<string,double|integer|array>
  */
 private function parseTestSuite($result)
 {
     $passed = 0;
     $error = 0;
     $failed = 0;
     $notImplemented = 0;
     $skipped = 0;
     $tests = [];
     foreach ($result->passed() as $key => $value) {
         $tests[] = $this->parseTest('passed', $key);
         $passed++;
     }
     foreach ($result->failures() as $obj) {
         $tests[] = $this->parseTest('failed', $obj);
         $failed++;
     }
     foreach ($result->skipped() as $obj) {
         $tests[] = $this->parseTest('skipped', $obj);
         $skipped++;
     }
     foreach ($result->notImplemented() as $obj) {
         $tests[] = $this->parseTest('notImplemented', $obj);
         $notImplemented++;
     }
     foreach ($result->errors() as $obj) {
         $tests[] = $this->parseTest('error', $obj);
         $error++;
     }
     usort($tests, function ($a, $b) {
         return strnatcmp($a['class'], $b['class']);
     });
     return ['time' => $result->time(), 'total' => count($tests), 'passed' => $passed, 'error' => $error, 'failed' => $failed, 'notImplemented' => $notImplemented, 'skipped' => $skipped, 'tests' => $tests];
 }