public function FileCacheFactoryTest::testGet in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php \Drupal\Tests\Component\FileCache\FileCacheFactoryTest::testGet()
- 9 core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php \Drupal\Tests\Component\FileCache\FileCacheFactoryTest::testGet()
@covers ::get
File
- core/
tests/ Drupal/ Tests/ Component/ FileCache/ FileCacheFactoryTest.php, line 39
Class
- FileCacheFactoryTest
- @coversDefaultClass \Drupal\Component\FileCache\FileCacheFactory @group FileCache
Namespace
Drupal\Tests\Component\FileCacheCode
public function testGet() {
$file_cache = FileCacheFactory::get('test_foo_settings', []);
// Ensure the right backend and configuration is used.
$filename = __DIR__ . '/Fixtures/llama-23.txt';
$realpath = realpath($filename);
$cid = 'prefix:test-23:' . $realpath;
$file_cache
->set($filename, 23);
$static_cache = new StaticFileCacheBackend([
'bin' => 'dog',
]);
$result = $static_cache
->fetch([
$cid,
]);
$this
->assertNotEmpty($result);
// Cleanup static caches.
$file_cache
->delete($filename);
}