Issue #2949363 by vaplas, Mile23, timmillwood, alexpott, Lendude: Impossible to make trigger_error in some files without test fails
parent
e551206954
commit
f22c3b0952
|
@ -325,7 +325,7 @@ class TestDiscovery {
|
|||
* If the class does not have a @group annotation.
|
||||
*/
|
||||
public static function getTestInfo($classname, $doc_comment = NULL) {
|
||||
if (!$doc_comment) {
|
||||
if ($doc_comment === NULL) {
|
||||
$reflection = new \ReflectionClass($classname);
|
||||
$doc_comment = $reflection->getDocComment();
|
||||
}
|
||||
|
|
|
@ -385,6 +385,21 @@ EOF;
|
|||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that classes are not reflected when the docblock is empty.
|
||||
*
|
||||
* @covers ::getTestInfo
|
||||
*/
|
||||
public function testGetTestInfoEmptyDocblock() {
|
||||
// If getTestInfo() performed reflection, it won't be able to find the
|
||||
// class we asked it to analyze, so it will throw a ReflectionException.
|
||||
// We want to make sure it didn't do that, because we already did some
|
||||
// analysis and already have an empty docblock. getTestInfo() will throw
|
||||
// MissingGroupException because the annotation is empty.
|
||||
$this->setExpectedException(MissingGroupException::class);
|
||||
TestDiscovery::getTestInfo('Drupal\Tests\simpletest\ThisTestDoesNotExistTest', '');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class TestTestDiscovery extends TestDiscovery {
|
||||
|
|
Loading…
Reference in New Issue