Exemplo n.º 1
0
 /**
  * @param \PHPUnit_Framework_TestResult $result
  */
 public function printResult(\PHPUnit_Framework_TestResult $result)
 {
     if ($this->runner->shouldNotify()) {
         ob_start();
     }
     $testDox = trim(TestDox::get(spl_object_hash($result)));
     if (strlen($testDox)) {
         $this->write(PHP_EOL . PHP_EOL . $testDox);
     }
     parent::printResult($result);
     if ($this->runner->shouldNotify()) {
         $output = ob_get_contents();
         ob_end_clean();
         echo $output;
         if ($result->failureCount() + $result->errorCount() + $result->skippedCount() + $result->notImplementedCount() == 0) {
             $notificationResult = Notification::RESULT_PASSED;
         } else {
             $notificationResult = Notification::RESULT_FAILED;
         }
         if (preg_match('/^(?:\\x1b\\[30;42m\\x1b\\[2K)?(OK .+)/m', $output, $matches)) {
             $notificationMessage = $matches[1];
         } elseif (preg_match('/^(?:\\x1b\\[37;41m\\x1b\\[2K)?(FAILURES!)\\s^(?:\\x1b\\[0m\\x1b\\[37;41m\\x1b\\[2K)?(.+)/m', $output, $matches)) {
             $notificationMessage = $matches[1] . PHP_EOL . $matches[2];
         } elseif (preg_match('/^(?:\\x1b\\[30;43m\\x1b\\[2K)?(OK, but incomplete or skipped tests!)\\s^(?:\\x1b\\[0m\\x1b\\[30;43m\\x1b\\[2K)?(.+)/m', $output, $matches)) {
             $notificationMessage = $matches[1] . PHP_EOL . $matches[2];
         } elseif (preg_match('/^(?:\\x1b\\[30;43m\\x1b\\[2K)?(No tests executed!)/m', $output, $matches)) {
             $notificationMessage = $matches[1];
         }
         $this->notification = new Notification($notificationResult, $notificationMessage);
     }
 }
Exemplo n.º 2
0
 /**
  * @param \PHPUnit_Framework_TestResult $result
  */
 public function printResult(\PHPUnit_Framework_TestResult $result)
 {
     if ($this->runner->shouldNotify()) {
         ob_start();
     }
     $testDox = trim(TestDox::get(spl_object_hash($result)));
     if (strlen($testDox)) {
         $this->write(PHP_EOL . PHP_EOL . $testDox);
     }
     parent::printResult($result);
     if ($this->runner->shouldNotify()) {
         $output = ob_get_contents();
         ob_end_clean();
         echo $output;
         if ($result->failureCount() + $result->errorCount() + $result->skippedCount() + $result->notImplementedCount() == 0) {
             $notificationResult = Notification::RESULT_PASSED;
         } else {
             $notificationResult = Notification::RESULT_FAILED;
         }
         $output = $this->removeAnsiEscapeCodesForColors($output);
         if (preg_match('/(OK \\(\\d+ tests?, \\d+ assertions?\\))/', $output, $matches)) {
             $notificationMessage = $matches[1];
         } elseif (preg_match('/(FAILURES!)\\s+(.*)/', $output, $matches)) {
             $notificationMessage = $matches[1] . PHP_EOL . $matches[2];
         } elseif (preg_match('/(OK, but incomplete,.*!)\\s+(.*)/', $output, $matches)) {
             $notificationMessage = $matches[1] . PHP_EOL . $matches[2];
         } elseif (preg_match('/(No tests executed!)/', $output, $matches)) {
             $notificationMessage = $matches[1];
         } else {
             $notificationMessage = '';
         }
         $this->notification = new Notification($notificationResult, $notificationMessage);
     }
 }
Exemplo n.º 3
0
 /**
  * @param string $testDox
  * @since Method available since Release 2.10.0
  */
 protected function appendTestDox($testDox)
 {
     TestDox::append($this->resultID, $testDox);
 }