3 namespace Friendica\Test\src\Core\Cache;
5 use Friendica\Core\Cache;
6 use Friendica\Factory\ConfigFactory;
7 use Friendica\Test\DatabaseTestTrait;
8 use Friendica\Test\Util\Database\StaticDatabase;
9 use Friendica\Test\Util\VFSTrait;
10 use Friendica\Util\ConfigFileLoader;
11 use Friendica\Util\Profiler;
12 use Psr\Log\NullLogger;
14 class DatabaseCacheTest extends CacheTest
16 use DatabaseTestTrait;
19 protected function setUp()
26 protected function getInstance()
28 $logger = new NullLogger();
29 $profiler = \Mockery::mock(Profiler::class);
30 $profiler->shouldReceive('saveTimestamp')->withAnyArgs()->andReturn(true);
32 // load real config to avoid mocking every config-entry which is related to the Database class
33 $configFactory = new ConfigFactory();
34 $loader = new ConfigFileLoader($this->root->url());
35 $configCache = $configFactory->createCache($loader);
37 $dba = new StaticDatabase($configCache, $profiler, $logger);
39 $this->cache = new Cache\DatabaseCache('database', $dba);
43 public function tearDown()
45 $this->cache->clear(false);