Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.1 KiB

* @copyright Copyright (C) 2010-2021, the Friendica project
* @license GNU AGPL version 3 or any later version
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <>.
namespace Friendica\Test\src\Core\Cache;
use Friendica\Core\Cache;
use Friendica\Factory\ConfigFactory;
use Friendica\Test\DatabaseTestTrait;
use Friendica\Test\Util\Database\StaticDatabase;
use Friendica\Test\Util\VFSTrait;
use Friendica\Util\ConfigFileLoader;
use Friendica\Util\Profiler;
use Mockery;
use Psr\Log\NullLogger;
class DatabaseCacheTest extends CacheTest
use DatabaseTestTrait;
use VFSTrait;
protected function setUp(): void
protected function getInstance()
$logger = new NullLogger();
$profiler = Mockery::mock(Profiler::class);
// load real config to avoid mocking every config-entry which is related to the Database class
$configFactory = new ConfigFactory();
$loader = new ConfigFileLoader($this->root->url(), []);
$configCache = $configFactory->createCache($loader);
$dba = new StaticDatabase($configCache, $profiler, $logger);
$this->cache = new Cache\DatabaseCache('database', $dba);
return $this->cache;
protected function tearDown(): void