class BackwardsCompatibilityClassLoaderTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/Core/ClassLoader/BackwardsCompatibilityClassLoaderTest.php \Drupal\KernelTests\Core\ClassLoader\BackwardsCompatibilityClassLoaderTest
Tests Drupal\Core\ClassLoader\BackwardsCompatibilityClassLoader.
Attributes
#[CoversClass(BackwardsCompatibilityClassLoader::class)]
#[Group('ClassLoader')]
#[RunTestsInSeparateProcesses]
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\Tests\DrupalTestCaseTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\KernelTests\Core\ClassLoader\BackwardsCompatibilityClassLoaderTest extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of BackwardsCompatibilityClassLoaderTest
File
-
core/
tests/ Drupal/ KernelTests/ Core/ ClassLoader/ BackwardsCompatibilityClassLoaderTest.php, line 23
Namespace
Drupal\KernelTests\Core\ClassLoaderView source
class BackwardsCompatibilityClassLoaderTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'module_autoload_test',
];
/**
* Tests that the bc layer for TranslationWrapper works.
*/
public function testTranslationWrapper() : void {
// @phpstan-ignore class.notFound
$object = new TranslationWrapper('Backward compatibility');
$this->assertInstanceOf(TranslatableMarkup::class, $object);
}
/**
* Tests that a moved class from a module works.
*/
public function testModuleMovedClass() : void {
// @phpstan-ignore class.notFound
$this->expectDeprecation('Class ' . Foo::class . ' is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0, use Drupal\\Component\\Utility\\Random instead. See https://example.com/change_record');
// @phpstan-ignore class.notFound
$object = new Foo();
$this->assertInstanceOf(Random::class, $object);
}
/**
* Tests that the BC layer for Doctrine's AnnotationException works.
*/
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.