You are here

public function PHPUnit_Util_Log_JUnit::addFailure in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Util/Log/JUnit.php \PHPUnit_Util_Log_JUnit::addFailure()

A failure occurred.

Parameters

PHPUnit_Framework_Test $test:

PHPUnit_Framework_AssertionFailedError $e:

float $time:

Overrides PHPUnit_Framework_TestListener::addFailure

File

vendor/phpunit/phpunit/src/Util/Log/JUnit.php, line 158

Class

PHPUnit_Util_Log_JUnit
A TestListener that generates a logfile of the test execution in XML markup.

Code

public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time) {
  if ($this->currentTestCase === null) {
    return;
  }
  if ($test instanceof PHPUnit_Framework_SelfDescribing) {
    $buffer = $test
      ->toString() . "\n";
  }
  else {
    $buffer = '';
  }
  $buffer .= PHPUnit_Framework_TestFailure::exceptionToString($e) . "\n" . PHPUnit_Util_Filter::getFilteredStacktrace($e);
  $failure = $this->document
    ->createElement('failure', PHPUnit_Util_XML::prepareString($buffer));
  $failure
    ->setAttribute('type', get_class($e));
  $this->currentTestCase
    ->appendChild($failure);
  $this->testSuiteFailures[$this->testSuiteLevel]++;
}