diff --git a/.travis.yml b/.travis.yml index af82f80..d54c114 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: php env: - CODECEPTION_VERSION: 'dev-phpunit-xml-reports' + CODECEPTION_VERSION: 'dev-phpunit-xml-reports-2' php: - 5.6 diff --git a/src/Log/PhpUnit.php b/src/Log/PhpUnit.php index b334134..c38446f 100644 --- a/src/Log/PhpUnit.php +++ b/src/Log/PhpUnit.php @@ -43,6 +43,15 @@ public function startTest(\PHPUnit\Framework\Test $test) $this->currentFile = $filename; $this->currentFileSuite = $this->document->createElement('testsuite'); + + if ($test instanceof Reported) { + $reportFields = $test->getReportFields(); + $class = isset($reportFields['class']) ? $reportFields['class'] : $reportFields['name']; + $this->currentFileSuite->setAttribute('name', $class); + } else { + $this->currentFileSuite->setAttribute('name', get_class($test)); + } + $this->currentFileSuite->setAttribute('file', $filename); $this->testSuites[self::SUITE_LEVEL]->appendChild($this->currentFileSuite);