public function FileCacheTest::testSet in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Component/FileCache/FileCacheTest.php \Drupal\Tests\Component\FileCache\FileCacheTest::testSet()
- 10 core/tests/Drupal/Tests/Component/FileCache/FileCacheTest.php \Drupal\Tests\Component\FileCache\FileCacheTest::testSet()
@covers ::set
File
- core/
tests/ Drupal/ Tests/ Component/ FileCache/ FileCacheTest.php, line 104
Class
- FileCacheTest
- @coversDefaultClass \Drupal\Component\FileCache\FileCache @group FileCache
Namespace
Drupal\Tests\Component\FileCacheCode
public function testSet() {
$filename = __DIR__ . '/Fixtures/llama-23.txt';
$realpath = realpath($filename);
$cid = 'prefix:test:' . $realpath;
$data = [
'mtime' => filemtime($realpath),
'filepath' => $realpath,
'data' => 23,
];
$this->fileCache
->set($filename, 23);
$result = $this->staticFileCache
->fetch([
$cid,
]);
$this
->assertEquals([
$cid => $data,
], $result);
// Cleanup static caches.
$this->fileCache
->delete($filename);
}