diff --git a/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryCachedTest.php b/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryCachedTest.php index ef839c9075..e19c557431 100644 --- a/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryCachedTest.php +++ b/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryCachedTest.php @@ -17,6 +17,9 @@ class AnnotatedClassDiscoveryCachedTest extends TestCase { */ protected function setUp() { 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'); } diff --git a/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php b/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php index e2de5ca210..2b1ccb2cb0 100644 --- a/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php @@ -13,34 +13,17 @@ */ class AnnotatedClassDiscoveryTest extends TestCase { - /** - * Original file cache configuration from before we disable it. - * - * @var array - */ - protected $originalFileCacheConfig; - /** * {@inheritdoc} */ protected function setUp() { parent::setUp(); - // Ensure that the NullFileCache implementation is used for the FileCache as - // unit tests should not be relying on caches implicitly. - $this->originalFileCacheConfig = FileCacheFactory::getConfiguration(); + // Ensure the file cache is disabled. FileCacheFactory::setConfiguration([FileCacheFactory::DISABLE_CACHE => TRUE]); // Ensure that FileCacheFactory has a prefix. FileCacheFactory::setPrefix('prefix'); } - /** - * {@inheritdoc} - */ - protected function tearDown() { - FileCacheFactory::setConfiguration($this->originalFileCacheConfig); - parent::tearDown(); - } - /** * @covers ::__construct * @covers ::getPluginNamespaces diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php index 032b8c7e9d..5139f97730 100644 --- a/core/tests/Drupal/Tests/UnitTestCase.php +++ b/core/tests/Drupal/Tests/UnitTestCase.php @@ -32,13 +32,6 @@ */ protected $root; - /** - * Original file cache configuration from before we disable it. - * - * @var array - */ - protected $originalFileCacheConfig; - /** * {@inheritdoc} */ @@ -50,7 +43,6 @@ protected function setUp() { // Ensure that the NullFileCache implementation is used for the FileCache as // unit tests should not be relying on caches implicitly. - $this->originalFileCacheConfig = FileCacheFactory::getConfiguration(); FileCacheFactory::setConfiguration([FileCacheFactory::DISABLE_CACHE => TRUE]); // Ensure that FileCacheFactory has a prefix. FileCacheFactory::setPrefix('prefix'); @@ -58,14 +50,6 @@ protected function setUp() { $this->root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__)))); } - /** - * {@inheritdoc} - */ - protected function tearDown() { - FileCacheFactory::setConfiguration($this->originalFileCacheConfig); - parent::tearDown(); - } - /** * Generates a unique random string containing letters and numbers. *