function DocParserTest::testAutoloadAnnotation

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php \Drupal\Tests\Component\Annotation\Doctrine\DocParserTest::testAutoloadAnnotation()
  2. 10 core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php \Drupal\Tests\Component\Annotation\Doctrine\DocParserTest::testAutoloadAnnotation()
  3. 11.x 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]);
}

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