function TestDiscoveryTest::testGetTestInfoEmptyDocblock

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php \Drupal\Tests\Core\Test\TestDiscoveryTest::testGetTestInfoEmptyDocblock()
  2. 10 core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php \Drupal\Tests\Core\Test\TestDiscoveryTest::testGetTestInfoEmptyDocblock()
  3. 11.x 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 540

Class

TestDiscoveryTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Test%21TestDiscovery.php/class/TestDiscovery/9" title="Discovers available tests." class="local">\Drupal\Core\Test\TestDiscovery</a> @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', '');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.