FileSystemBackendTest.php in File Cache 8
File
tests/src/Kernel/FileSystemBackendTest.php
View source
<?php
namespace Drupal\Tests\filecache\Kernel;
use Drupal\KernelTests\Core\Cache\GenericCacheBackendUnitTestBase;
class FileSystemBackendTest extends GenericCacheBackendUnitTestBase {
protected static $modules = [
'file',
'filecache',
'system',
'user',
];
protected function setUp() {
parent::setUp();
$this
->installConfig([
'system',
]);
$this
->installEntitySchema('file');
$this
->installEntitySchema('user');
$this
->installSchema('file', [
'file_usage',
]);
}
protected function createCacheBackend($bin) {
$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);
}
protected function tearDown() {
$this->cachebackends = [];
parent::tearDown();
}
}