Refactor Cache/Lock to DICE

- Refactor Cache classes
- Refactor Lock classes
- Improved test speed (removed some seperate class annotations)
This commit is contained in:
Philipp Holzer 2019-08-03 20:48:56 +02:00
parent b95d4f41b9
commit d56bd28a07
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
40 changed files with 766 additions and 621 deletions

View file

@ -2,6 +2,10 @@
namespace Friendica\Test\src\Core\Lock;
use Dice\Dice;
use Friendica\App;
use Friendica\BaseObject;
use Friendica\Core\Config\Configuration;
use Friendica\Core\Lock\SemaphoreLockDriver;
class SemaphoreLockDriverTest extends LockTest
@ -10,12 +14,21 @@ class SemaphoreLockDriverTest extends LockTest
{
parent::setUp();
$this->app->shouldReceive('getHostname')->andReturn('friendica.local');
$dice = \Mockery::mock(Dice::class)->makePartial();
$this->configMock
$app = \Mockery::mock(App::class);
$app->shouldReceive('getHostname')->andReturn('friendica.local');
$dice->shouldReceive('create')->with(App::class)->andReturn($app);
$configMock = \Mockery::mock(Configuration::class);
$configMock
->shouldReceive('get')
->with('system', 'temppath')
->with('system', 'temppath', NULL, false)
->andReturn('/tmp/');
$dice->shouldReceive('create')->with(Configuration::class)->andReturn($configMock);
// @todo Because "get_temppath()" is using static methods, we have to initialize the BaseObject
BaseObject::setDependencyInjection($dice);
}
protected function getInstance()