You are here

public function PHPUnit_Util_Log_JUnit::endTest 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::endTest()

A test ended.

Parameters

PHPUnit_Framework_Test $test:

float $time:

Overrides PHPUnit_Framework_TestListener::endTest

File

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

Class

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

Code

public function endTest(PHPUnit_Framework_Test $test, $time) {
  if ($this->attachCurrentTestCase) {
    if ($test instanceof PHPUnit_Framework_TestCase) {
      $numAssertions = $test
        ->getNumAssertions();
      $this->testSuiteAssertions[$this->testSuiteLevel] += $numAssertions;
      $this->currentTestCase
        ->setAttribute('assertions', $numAssertions);
    }
    $this->currentTestCase
      ->setAttribute('time', sprintf('%F', $time));
    $this->testSuites[$this->testSuiteLevel]
      ->appendChild($this->currentTestCase);
    $this->testSuiteTests[$this->testSuiteLevel]++;
    $this->testSuiteTimes[$this->testSuiteLevel] += $time;
    if (method_exists($test, 'hasOutput') && $test
      ->hasOutput()) {
      $systemOut = $this->document
        ->createElement('system-out');
      $systemOut
        ->appendChild($this->document
        ->createTextNode($test
        ->getActualOutput()));
      $this->currentTestCase
        ->appendChild($systemOut);
    }
  }
  $this->attachCurrentTestCase = true;
  $this->currentTestCase = null;
}