StaticReflectionParserTest.php

Same filename and directory in other branches
  1. 10 core/tests/Drupal/Tests/Component/Annotation/Doctrine/StaticReflectionParserTest.php

Namespace

Drupal\Tests\Component\Annotation\Doctrine

File

core/tests/Drupal/Tests/Component/Annotation/Doctrine/StaticReflectionParserTest.php

View source
<?php

namespace Drupal\Tests\Component\Annotation\Doctrine;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\TestWith;
use Drupal\Component\Annotation\Doctrine\StaticReflectionParser;
use Drupal\Component\Annotation\Reflection\MockFileFinder;
use PHPUnit\Framework\TestCase;

/**
 * Tests Drupal\Component\Annotation\Doctrine\StaticReflectionParser.
 */
class StaticReflectionParserTest extends TestCase {
  public function testAttribute(string $class, string $attribute_class, bool $expected) : void {
    $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}'");
  }

}

Classes

Title Deprecated Summary
StaticReflectionParserTest Tests Drupal\Component\Annotation\Doctrine\StaticReflectionParser.

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