class StaticReflectionParserTest
@coversDefaultClass \Drupal\Component\Annotation\Doctrine\StaticReflectionParser
      
    
@group Annotation
Hierarchy
- class \Drupal\Tests\Component\Annotation\Doctrine\StaticReflectionParserTest extends \PHPUnit\Framework\TestCase
Expanded class hierarchy of StaticReflectionParserTest
File
- 
              core/tests/ Drupal/ Tests/ Component/ Annotation/ Doctrine/ StaticReflectionParserTest.php, line 14 
Namespace
Drupal\Tests\Component\Annotation\DoctrineView source
class StaticReflectionParserTest extends TestCase {
  
  /**
   * @testWith ["AttributeClass", "\\Attribute", true]
   *           ["AttributeClass", "attribute", true]
   *           ["AttributeClass", "Attribute", true]
   *           ["AttributeClass", "\\DoesNotExist", false]
   *           ["Nonexistent", "NonexistentAttribute", false]
   *           ["MultipleAttributes", "Attribute", true]
   *           ["MultipleAttributes", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\Attribute\\AttributeClass", true]
   *           ["MultipleAttributes", "DoesNotExist", false]
   *           ["FullyQualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleAttribute", true]
   *           ["Used", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleAttribute", true]
   *           ["UsedAs", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleAttribute", true]
   *           ["UsedAsQualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleAttribute", true]
   *           ["Qualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleAttribute", true]
   *           ["Relative", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\Attribute\\SubDir\\SubDirAttribute", true]
   *           ["FullyQualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleParentAttribute", true]
   *           ["Used", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleParentAttribute", true]
   *           ["UsedAs", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleParentAttribute", true]
   *           ["UsedAsQualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleParentAttribute", true]
   *           ["Qualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleParentAttribute", true]
   */
  public function testAttribute(string $class, string $attribute_class, bool $expected) {
    $finder = MockFileFinder::create(__DIR__ . '/Fixtures/Attribute/' . $class . '.php');
    $parser = new StaticReflectionParser('\\Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\Attribute\\' . $class, $finder);
    $this->assertSame($expected, $parser->hasClassAttribute($attribute_class), "'{$class}' has attribute that is a '{$attribute_class}'");
  }
}Members
| Title Sort descending | Modifiers | Object type | Summary | 
|---|---|---|---|
| StaticReflectionParserTest::testAttribute | public | function | @testWith ["AttributeClass", "\\Attribute", true][[api-linebreak]] ["AttributeClass", "attribute", true][[api-linebreak]] ["AttributeClass", "Attribute",… | 
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
