Creating interfaces for Config/PConfig & fix tests

This commit is contained in:
nupplaPhil 2019-12-19 20:11:07 +01:00
parent 4835f1185f
commit c1dbb25656
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
54 changed files with 349 additions and 285 deletions

View file

@ -4,27 +4,29 @@ namespace Friendica\Test\src\Core\Lock;
use Dice\Dice;
use Friendica\App;
use Friendica\Core\Config\Configuration;
use Friendica\Core\Config\IConfiguration;
use Friendica\Core\Config\JitConfiguration;
use Friendica\Core\Lock\SemaphoreLock;
use Friendica\DI;
use Mockery\MockInterface;
class SemaphoreLockTest extends LockTest
{
public function setUp()
{
/** @var MockInterface|Dice $dice */
$dice = \Mockery::mock(Dice::class)->makePartial();
$app = \Mockery::mock(App::class);
$app->shouldReceive('getHostname')->andReturn('friendica.local');
$dice->shouldReceive('create')->with(App::class)->andReturn($app);
$dice->shouldReceive('create')->with(App::class, [])->andReturn($app);
$configMock = \Mockery::mock(JitConfiguration::class);
$configMock
->shouldReceive('get')
->with('system', 'temppath', NULL, false)
->andReturn('/tmp/');
$dice->shouldReceive('create')->with(Configuration::class)->andReturn($configMock);
$dice->shouldReceive('create')->with(IConfiguration::class, [])->andReturn($configMock);
// @todo Because "get_temppath()" is using static methods, we have to initialize the BaseObject
DI::init($dice);