]> git.mxchange.org Git - friendica.git/blobdiff - tests/src/Core/Lock/DatabaseLockDriverTest.php
Merge pull request #11195 from annando/issue-10966
[friendica.git] / tests / src / Core / Lock / DatabaseLockDriverTest.php
index e08a0d7ca82be623b56b44428f1e8bb296ca27c3..bd4cb9cc9bcece272ca0ecfe894831d916b84f7b 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -22,7 +22,8 @@
 namespace Friendica\Test\src\Core\Lock;
 
 use Friendica\Core\Lock\Type\DatabaseLock;
-use Friendica\Core\Config\Factory\ConfigFactory;
+use Friendica\Core\Config\Factory\Config;
+use Friendica\DI;
 use Friendica\Test\DatabaseTestTrait;
 use Friendica\Test\Util\Database\StaticDatabase;
 use Friendica\Test\Util\VFSTrait;
@@ -48,20 +49,7 @@ class DatabaseLockDriverTest extends LockTest
 
        protected function getInstance()
        {
-               $logger   = new NullLogger();
-               $profiler = Mockery::mock(Profiler::class);
-               $profiler->shouldReceive('startRecording');
-               $profiler->shouldReceive('stopRecording');
-               $profiler->shouldReceive('saveTimestamp')->withAnyArgs()->andReturn(true);
-
-               // load real config to avoid mocking every config-entry which is related to the Database class
-               $configFactory = new ConfigFactory();
-               $loader        = (new ConfigFactory())->createConfigFileLoader($this->root->url(), []);
-               $configCache   = $configFactory->createCache($loader);
-
-               $dba = new StaticDatabase($configCache, $profiler, $logger);
-
-               return new DatabaseLock($dba, $this->pid);
+               return new DatabaseLock(DI::dba(), $this->pid);
        }
 
        protected function tearDown(): void