3 namespace Friendica\Test\src\Core\Lock;
5 use Friendica\Core\Lock\DatabaseLock;
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 DatabaseLockDriverTest extends LockTest
17 use DatabaseTestTrait;
21 protected function setUp()
28 protected function getInstance()
30 $logger = new NullLogger();
31 $profiler = \Mockery::mock(Profiler::class);
32 $profiler->shouldReceive('saveTimestamp')->withAnyArgs()->andReturn(true);
34 // load real config to avoid mocking every config-entry which is related to the Database class
35 $configFactory = new ConfigFactory();
36 $loader = new ConfigFileLoader($this->root->url());
37 $configCache = $configFactory->createCache($loader);
39 $dba = new StaticDatabase($configCache, $profiler, $logger);
41 return new DatabaseLock($dba, $this->pid);