function AttributeClassDiscoveryTest::setUp

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

File

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

Class

AttributeClassDiscoveryTest
@coversDefaultClass \Drupal\Component\Plugin\Discovery\AttributeClassDiscovery[[api-linebreak]] @group Attribute @runTestsInSeparateProcesses

Namespace

Drupal\Tests\Component\Plugin\Attribute

Code

protected function setUp() : void {
  parent::setUp();
  // Ensure the file cache is disabled.
  FileCacheFactory::setConfiguration([
    FileCacheFactory::DISABLE_CACHE => TRUE,
  ]);
  // 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.