Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00%
0 / 1
0.00%
0 / 2
CRAP
0.00%
0 / 27
JUnit
0.00%
0 / 1
0.00%
0 / 2
56
0.00%
0 / 27
 startTest(\PHPUnit_Framework_Test $test)
0.00%
0 / 1
30
0.00%
0 / 19
 endTest(\PHPUnit_Framework_Test $test, $time)
0.00%
0 / 1
6
0.00%
0 / 8
<?php
namespace Codeception\PHPUnit\Log;
class JUnit extends \PHPUnit_Util_Log_JUnit
{
public function startTest(\PHPUnit_Framework_Test $test)
{
if (!($test instanceof \Codeception\TestCase)) return parent::startTest($test);
$testCase = $this->document->createElement('testcase');
if ($test instanceof \Codeception\TestCase\Cept) {
$testCase->setAttribute('file', $test->getFileName());
}
if ($test instanceof \Codeception\TestCase\Cest) {
$class = new \ReflectionClass($test->getTestClass());
$methodName = $test->getTestMethod();
if ($class->hasMethod($methodName)) {
$method = $class->getMethod($methodName);
$testCase->setAttribute('class', $class->getName());
$testCase->setAttribute('file', $class->getFileName());
$testCase->setAttribute('line', $method->getStartLine());
}
}
$this->currentTestCase = $testCase;
}
public function endTest(\PHPUnit_Framework_Test $test, $time) {
if ($test instanceof \Codeception\TestCase) {
$this->currentTestCase->setAttribute(
'name', $test->toString()
);
}
return parent::endTest($test, $time);
}
}