3 namespace Friendica\Test\src\Model\Storage;
5 use Friendica\Core\L10n;
6 use Friendica\Factory\ConfigFactory;
7 use Friendica\Model\Storage\Database;
8 use Friendica\Model\Storage\IStorage;
9 use Friendica\Test\DatabaseTestTrait;
10 use Friendica\Test\Util\Database\StaticDatabase;
11 use Friendica\Test\Util\VFSTrait;
12 use Friendica\Util\ConfigFileLoader;
13 use Friendica\Util\Profiler;
14 use Mockery\MockInterface;
15 use Psr\Log\NullLogger;
17 class DatabaseStorageTest extends StorageTest
19 use DatabaseTestTrait;
22 protected function setUp()
29 protected function getInstance()
31 $logger = new NullLogger();
32 $profiler = \Mockery::mock(Profiler::class);
33 $profiler->shouldReceive('saveTimestamp')->withAnyArgs()->andReturn(true);
35 // load real config to avoid mocking every config-entry which is related to the Database class
36 $configFactory = new ConfigFactory();
37 $loader = new ConfigFileLoader($this->root->url());
38 $configCache = $configFactory->createCache($loader);
40 $dba = new StaticDatabase($configCache, $profiler, $logger);
42 /** @var MockInterface|L10n $l10n */
43 $l10n = \Mockery::mock(L10n::class)->makePartial();
45 return new Database($dba, $logger, $l10n);
48 protected function assertOption(IStorage $storage)
50 $this->assertEmpty($storage->getOptions());