You are here

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

A test started.

Parameters

PHPUnit_Framework_Test $test:

Overrides PHPUnit_Framework_TestListener::startTest

File

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

Class

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

Code

public function startTest(PHPUnit_Framework_Test $test) {
  $testCase = $this->document
    ->createElement('testcase');
  $testCase
    ->setAttribute('name', $test
    ->getName());
  if ($test instanceof PHPUnit_Framework_TestCase) {
    $class = new ReflectionClass($test);
    $methodName = $test
      ->getName();
    if ($class
      ->hasMethod($methodName)) {
      $method = $class
        ->getMethod($test
        ->getName());
      $testCase
        ->setAttribute('class', $class
        ->getName());
      $testCase
        ->setAttribute('file', $class
        ->getFileName());
      $testCase
        ->setAttribute('line', $method
        ->getStartLine());
    }
  }
  $this->currentTestCase = $testCase;
}