You are here

public function DocParserTest::testAutoloadAnnotation in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php \Drupal\Tests\Component\Annotation\Doctrine\DocParserTest::testAutoloadAnnotation()
  2. 9 core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php \Drupal\Tests\Component\Annotation\Doctrine\DocParserTest::testAutoloadAnnotation()

@group DCOM-56

File

core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php, line 1049

Class

DocParserTest
@coversDefaultClass \Drupal\Component\Annotation\Doctrine\DocParser

Namespace

Drupal\Tests\Component\Annotation\Doctrine

Code

public function testAutoloadAnnotation() {
  $this
    ->assertFalse(class_exists('Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixture\\Annotation\\Autoload', false), 'Pre-condition: Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixture\\Annotation\\Autoload not allowed to be loaded.');
  $parser = new DocParser();
  AnnotationRegistry::registerAutoloadNamespace('Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\Annotation', __DIR__ . '/../../../../');
  $parser
    ->setImports(array(
    'autoload' => 'Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\Annotation\\Autoload',
  ));
  $annotations = $parser
    ->parse('@Autoload');
  $this
    ->assertCount(1, $annotations);
  $this
    ->assertInstanceOf('Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\Annotation\\Autoload', $annotations[0]);
}