You are here

public function DocParserTest::testReservedKeywordsInAnnotations in Drupal 9

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

File

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

Class

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

Namespace

Drupal\Tests\Component\Annotation\Doctrine

Code

public function testReservedKeywordsInAnnotations() {
  if (PHP_VERSION_ID >= 70000) {
    $this
      ->markTestSkipped('This test requires PHP 5.6 or lower.');
  }
  require 'ReservedKeywordsClasses.php';
  $parser = $this
    ->createTestParser();
  $result = $parser
    ->parse('@Drupal\\Tests\\Component\\Annotation\\Doctrine\\True');
  $this
    ->assertInstanceOf(True::class, $result[0]);
  $result = $parser
    ->parse('@Drupal\\Tests\\Component\\Annotation\\Doctrine\\False');
  $this
    ->assertInstanceOf(False::class, $result[0]);
  $result = $parser
    ->parse('@Drupal\\Tests\\Component\\Annotation\\Doctrine\\Null');
  $this
    ->assertInstanceOf(Null::class, $result[0]);
  $result = $parser
    ->parse('@True');
  $this
    ->assertInstanceOf(True::class, $result[0]);
  $result = $parser
    ->parse('@False');
  $this
    ->assertInstanceOf(False::class, $result[0]);
  $result = $parser
    ->parse('@Null');
  $this
    ->assertInstanceOf(Null::class, $result[0]);
}