protected function FileSystemBackendTest::createCacheBackend in File Cache 8
Creates a cache backend to test.
Override this method to test a CacheBackend.
Parameters
string $bin: Bin name to use for this backend instance.
Return value
\Drupal\Core\Cache\CacheBackendInterface Cache backend to test.
Overrides GenericCacheBackendUnitTestBase::createCacheBackend
1 method overrides FileSystemBackendTest::createCacheBackend()
- PersistentFileSystemBackendTest::createCacheBackend in tests/
src/ Kernel/ PersistentFileSystemBackendTest.php - Creates a cache backend to test.
File
- tests/
src/ Kernel/ FileSystemBackendTest.php, line 39
Class
- FileSystemBackendTest
- Tests the FileSystemBackend cache backend.
Namespace
Drupal\Tests\filecache\KernelCode
protected function createCacheBackend($bin) {
// Set the FileSystemBackend as the default cache backend.
$this
->setSetting('cache', [
'default' => 'cache.backend.file_system',
]);
$base_path = file_default_scheme() . '://filecache';
$cache_path_settings = [
'directory' => [
'default' => $base_path,
'bins' => [
'foo' => $base_path . '/foo',
'bar' => $base_path . '/bar',
],
],
];
$this
->setSetting('filecache', $cache_path_settings);
return $this->container
->get('cache.backend.file_system')
->get($bin);
}