public function PHPUnit_Util_Log_JUnit::startTest

A test started.

Parameters

PHPUnit_Framework_Test $test:

Overrides PHPUnit_Framework_TestListener::startTest

File

drupal/core/vendor/phpunit/phpunit/PHPUnit/Util/Log/JUnit.php, line 396

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) {
  if (!$test instanceof PHPUnit_Framework_Warning) {
    $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;
  }
}