You are here

public function DocParserTest::testAutoloadAnnotation in Drupal 8

Same name and namespace in other branches
  1. 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 1052

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]);
}