function BackwardsCompatibilityClassLoaderTest::testDoctrineException

Tests that the BC layer for Doctrine's AnnotationException works.

Attributes

#[IgnoreDeprecations]

File

core/tests/Drupal/KernelTests/Core/ClassLoader/BackwardsCompatibilityClassLoaderTest.php, line 57

Class

BackwardsCompatibilityClassLoaderTest
Tests Drupal\Core\ClassLoader\BackwardsCompatibilityClassLoader.

Namespace

Drupal\KernelTests\Core\ClassLoader

Code

public function testDoctrineException() : void {
  // @phpstan-ignore class.notFound
  $this->expectException(DoctrineAnnotationException::class);
  $this->expectExceptionMessage('[Syntax Error] test');
  $this->expectDeprecation('Class Doctrine\\Common\\Annotations\\AnnotationException is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0, use Drupal\\Component\\Annotation\\Doctrine\\AnnotationException instead. See https://www.drupal.org/node/3551049');
  throw AnnotationException::syntaxError('test');
}

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