public function FileCacheFactoryTest::testGetDisabledFileCache in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php \Drupal\Tests\Component\FileCache\FileCacheFactoryTest::testGetDisabledFileCache()
- 9 core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php \Drupal\Tests\Component\FileCache\FileCacheFactoryTest::testGetDisabledFileCache()
@covers ::get
File
- core/
tests/ Drupal/ Tests/ Component/ FileCache/ FileCacheFactoryTest.php, line 70
Class
- FileCacheFactoryTest
- @coversDefaultClass \Drupal\Component\FileCache\FileCacheFactory @group FileCache
Namespace
Drupal\Tests\Component\FileCacheCode
public function testGetDisabledFileCache() {
// Ensure the returned FileCache is an instance of FileCache::class.
$file_cache = FileCacheFactory::get('test_foo_settings', []);
$this
->assertInstanceOf(FileCache::class, $file_cache);
$configuration = FileCacheFactory::getConfiguration();
$configuration[FileCacheFactory::DISABLE_CACHE] = TRUE;
FileCacheFactory::setConfiguration($configuration);
// Ensure the returned FileCache is now an instance of NullFileCache::class.
$file_cache = FileCacheFactory::get('test_foo_settings', []);
$this
->assertInstanceOf(NullFileCache::class, $file_cache);
}