function AttributeClassDiscoveryCachedTest::setUp

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryCachedTest.php \Drupal\Tests\Component\Plugin\Attribute\AttributeClassDiscoveryCachedTest::setUp()

File

core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryCachedTest.php, line 22

Class

AttributeClassDiscoveryCachedTest
@coversDefaultClass \Drupal\Component\Plugin\Discovery\AttributeClassDiscovery @group Attribute @runTestsInSeparateProcesses

Namespace

Drupal\Tests\Component\Plugin\Attribute

Code

protected function setUp() : void {
    parent::setUp();
    // Ensure FileCacheFactory::DISABLE_CACHE is *not* set, since we're testing
    // integration with the file cache.
    FileCacheFactory::setConfiguration([]);
    // Ensure that FileCacheFactory has a prefix.
    FileCacheFactory::setPrefix('prefix');
    // Normally the attribute classes would be autoloaded.
    include_once __DIR__ . '/../../../../../fixtures/plugins/CustomPlugin.php';
    $additionalClassLoader = new ClassLoader();
    $additionalClassLoader->addPsr4("com\\example\\PluginNamespace\\", __DIR__ . "/../../../../../fixtures/plugins/Plugin/PluginNamespace");
    $additionalClassLoader->register(TRUE);
}

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