Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Handle test suite names correctly that are not the name of a test cas…

…e class.
  • Loading branch information...
commit 13e035a7b4fcad07fa87a55f62adf71be52709cf 1 parent 74fd829
Sebastian Bergmann authored
Showing with 17 additions and 15 deletions.
  1. +17 −15 PHPUnit/Util/Log/XML.php
32 PHPUnit/Util/Log/XML.php
View
@@ -242,26 +242,28 @@ public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
$testSuite = $this->document->createElement('testsuite');
$testSuite->setAttribute('name', $suite->getName());
- try {
- $class = new ReflectionClass($suite->getName());
- $docComment = $class->getDocComment();
-
- if (preg_match('/@category[\s]+([\.\w]+)/', $docComment, $matches)) {
- $testSuite->setAttribute('category', $matches[1]);
- }
-
- if (preg_match('/@package[\s]+([\.\w]+)/', $docComment, $matches)) {
- $testSuite->setAttribute('package', $matches[1]);
+ if (class_exists($suite->getName(), FALSE)) {
+ try {
+ $class = new ReflectionClass($suite->getName());
+ $docComment = $class->getDocComment();
+
+ if (preg_match('/@category[\s]+([\.\w]+)/', $docComment, $matches)) {
+ $testSuite->setAttribute('category', $matches[1]);
+ }
+
+ if (preg_match('/@package[\s]+([\.\w]+)/', $docComment, $matches)) {
+ $testSuite->setAttribute('package', $matches[1]);
+ }
+
+ if (preg_match('/@subpackage[\s]+([\.\w]+)/', $docComment, $matches)) {
+ $testSuite->setAttribute('subpackage', $matches[1]);
+ }
}
- if (preg_match('/@subpackage[\s]+([\.\w]+)/', $docComment, $matches)) {
- $testSuite->setAttribute('subpackage', $matches[1]);
+ catch (ReflectionException $e) {
}
}
- catch (ReflectionException $e) {
- }
-
if ($this->testSuiteLevel > 0) {
$this->testSuites[$this->testSuiteLevel]->appendChild($testSuite);
} else {
Please sign in to comment.
Something went wrong with that request. Please try again.