|
|
|
@ -54,11 +54,11 @@ trait AppMockTrait
|
|
|
|
|
|
|
|
|
|
$this->configMock = \Mockery::mock(Config\Cache\ConfigCache::class);
|
|
|
|
|
$this->dice->shouldReceive('create')
|
|
|
|
|
->with(Config\Cache\ConfigCache::class, [])
|
|
|
|
|
->with(Config\Cache\ConfigCache::class)
|
|
|
|
|
->andReturn($this->configMock);
|
|
|
|
|
$this->mode = \Mockery::mock(App\Mode::class);
|
|
|
|
|
$this->dice->shouldReceive('create')
|
|
|
|
|
->with(App\Mode::class, [])
|
|
|
|
|
->with(App\Mode::class)
|
|
|
|
|
->andReturn($this->mode);
|
|
|
|
|
$configModel= \Mockery::mock(\Friendica\Model\Config\Config::class);
|
|
|
|
|
// Disable the adapter
|
|
|
|
@ -66,48 +66,33 @@ trait AppMockTrait
|
|
|
|
|
|
|
|
|
|
$config = new Config\JitConfiguration($this->configMock, $configModel);
|
|
|
|
|
$this->dice->shouldReceive('create')
|
|
|
|
|
->with(Config\IConfiguration::class, [])
|
|
|
|
|
->with(Config\IConfiguration::class)
|
|
|
|
|
->andReturn($config);
|
|
|
|
|
|
|
|
|
|
// Mocking App and most used functions
|
|
|
|
|
$this->app = \Mockery::mock(App::class);
|
|
|
|
|
$this->dice->shouldReceive('create')
|
|
|
|
|
->with(App::class, [])
|
|
|
|
|
->with(App::class)
|
|
|
|
|
->andReturn($this->app);
|
|
|
|
|
$this->app
|
|
|
|
|
->shouldReceive('getBasePath')
|
|
|
|
|
->andReturn($root->url());
|
|
|
|
|
|
|
|
|
|
$this->app
|
|
|
|
|
->shouldReceive('getMode')
|
|
|
|
|
->andReturn($this->mode);
|
|
|
|
|
|
|
|
|
|
$this->profilerMock = \Mockery::mock(Profiler::class);
|
|
|
|
|
$this->profilerMock->shouldReceive('saveTimestamp');
|
|
|
|
|
$this->dice->shouldReceive('create')
|
|
|
|
|
->with(Profiler::class, [])
|
|
|
|
|
->with(Profiler::class)
|
|
|
|
|
->andReturn($this->profilerMock);
|
|
|
|
|
|
|
|
|
|
$this->app
|
|
|
|
|
->shouldReceive('getConfigCache')
|
|
|
|
|
->andReturn($this->configMock);
|
|
|
|
|
$this->app
|
|
|
|
|
->shouldReceive('getConfig')
|
|
|
|
|
->andReturn($config);
|
|
|
|
|
$this->app
|
|
|
|
|
->shouldReceive('getTemplateEngine')
|
|
|
|
|
->andReturn(new FriendicaSmartyEngine());
|
|
|
|
|
$this->app
|
|
|
|
|
->shouldReceive('getCurrentTheme')
|
|
|
|
|
->andReturn('Smarty3');
|
|
|
|
|
$this->app
|
|
|
|
|
->shouldReceive('getProfiler')
|
|
|
|
|
->andReturn($this->profilerMock);
|
|
|
|
|
$this->app
|
|
|
|
|
->shouldReceive('getBaseUrl')
|
|
|
|
|
->andReturnUsing(function () {
|
|
|
|
|
return $this->configMock->get('system', 'url');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
DI::init($this->dice);
|
|
|
|
|
|
|
|
|
|