diff --git a/src/ParaTest/Console/Testers/PHPUnit.php b/src/ParaTest/Console/Testers/PHPUnit.php index 45b62e64..5390003c 100644 --- a/src/ParaTest/Console/Testers/PHPUnit.php +++ b/src/ParaTest/Console/Testers/PHPUnit.php @@ -1,4 +1,4 @@ -refl->getDocComment(), - $this->refl->getName(), + $this->getCleanReflectionName(), $this->refl->getNamespaceName(), $this->getMethods() ); } + /** + * Return reflection name with null bytes stripped + * + * @return string + */ + private function getCleanReflectionName() + { + return str_replace("\x00", '', $this->refl->getName()); + } + /** * Return all test methods present in the file * diff --git a/test/fixtures/failing-tests/AnonymousClass.inc b/test/fixtures/failing-tests/AnonymousClass.inc new file mode 100644 index 00000000..c192dbb9 --- /dev/null +++ b/test/fixtures/failing-tests/AnonymousClass.inc @@ -0,0 +1,13 @@ +assertEquals('Fixtures\\Tests\\UnitTestWithClassAnnotationTest', $class->getName()); } + public function testParsedAnonymousClassNameHasNoNullByte() + { + if (PHP_VERSION_ID < 70000) { + return $this->markTestSkipped('php versions prior to php7 does not support anonymous classes'); + } + + $class = $this->parseFile($this->fixture('failing-tests/AnonymousClass.inc')); + $this->assertNotContains("\x00", $class->getName()); + } + public function testParsedClassHasDocBlock() { $class = $this->parseFile($this->fixture('failing-tests/UnitTestWithClassAnnotationTest.php'));