public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
 {
     $class = get_class($test);
     $message = $this->escape($e->getMessage());
     $trace = $this->escape($e->getTraceAsString());
     echo "##teamcity[testFailed type='failure' name='{$class}.{$test->getName()}' message='{$message}'" . " details='{$trace}']\n";
 }
 public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
 {
     $this->_fails += 1;
     if ($this->_fails == 1) {
         echo "\n<div class=\"failure\">";
     }
     printf("Test '%s' failed : %s.<br />\n<pre>%s</pre>\n", $test->getName(), htmlentities($e->getMessage()), (string) $e->getTraceAsString());
     //echo("Failure $this->_fails : $t<br>\n");
 }
Example #3
0
 public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
 {
     if ($this->verbose) {
         echo "        FAIL: '" . $e->getMessage() . "'\n" . $e->getTraceAsString();
     }
     parent::addFailure($test, $e, $time);
     if ($this->_blDBResetPerTest && !isset($test->blNoDbResetAfterTest)) {
         $this->_oDBMaintenance->restoreDB($this->_iDBChangeMode, $this->_iDBChangeOutput);
         echo "|";
     }
 }
 /**
  * A failure occurred.
  *
  * @todo Add check that $test is instance of PHPUnit_Framework_TestCase
  *
  * @param  PHPUnit_Framework_Test                 $test
  * @param  PHPUnit_Framework_AssertionFailedError $e
  * @param  float                                  $time
  */
 public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
 {
     $failures = array();
     $testResult = $test->getTestResultObject();
     /** @var $failure PHPUnit_Framework_TestFailure */
     foreach ($testResult->failures() as $failure) {
         $hash = "{$e->getMessage()} {$e->getTraceAsString()}";
         if (isset($failures[$hash])) {
             continue;
         }
         $array = array('type' => self::MESSAGE_COMPARISON_FAILURE, 'name' => $test->getName(), 'message' => $e->getMessage(), 'details' => $e->getTraceAsString());
         /** @var $exception PHPUnit_Framework_ExpectationFailedException */
         $exception = $failure->thrownException();
         $comparisonFailure = $exception->getComparisonFailure();
         if ($comparisonFailure instanceof PHPUnit_Framework_ComparisonFailure) {
             $array += array('expected' => $comparisonFailure->getExpectedAsString(), 'actual' => $comparisonFailure->getActualAsString());
         }
         $message = $this->getServiceMessage(self::MESSAGE_TEST_FAILED, $array);
         $this->write($message);
         $failures[$hash] = true;
     }
 }