You are here

public function TestDiscoveryTest::testGetTestInfoEmptyDocblock in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php \Drupal\Tests\Core\Test\TestDiscoveryTest::testGetTestInfoEmptyDocblock()

Ensure that classes are not reflected when the docblock is empty.

@covers ::getTestInfo

File

core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php, line 542

Class

TestDiscoveryTest
@coversDefaultClass \Drupal\Core\Test\TestDiscovery @group Test

Namespace

Drupal\Tests\Core\Test

Code

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
    ->expectException(MissingGroupException::class);
  TestDiscovery::getTestInfo('Drupal\\Tests\\simpletest\\ThisTestDoesNotExistTest', '');
}