1
1
Fork 0

Config FollowUp

- New Configuration (Config is now only holding the instance)
- New PConfiguration (PConfig is now only holding the instance)

- Config & PConfig-Adapter don't need "ConfigCache" anymore

- DB-Connection is now outside App->reload() for better dependency-chaining
This commit is contained in:
Philipp Holzer 2019-02-10 19:52:21 +01:00
commit eafcf3592d
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
59 changed files with 1754 additions and 1038 deletions

View file

@ -5,7 +5,6 @@ namespace Friendica\Test\Util;
use Friendica\App;
use Friendica\BaseObject;
use Friendica\Core\Config;
use Friendica\Core\Config\ConfigCache;
use Friendica\Render\FriendicaSmartyEngine;
use Mockery\MockInterface;
use org\bovigo\vfs\vfsStreamDirectory;
@ -21,7 +20,7 @@ trait AppMockTrait
protected $app;
/**
* @var MockInterface|ConfigCache The mocked Config Cache
* @var MockInterface|Config\Configuration The mocked Config Cache
*/
protected $configCache;
@ -29,9 +28,9 @@ trait AppMockTrait
* Mock the App
*
* @param vfsStreamDirectory $root The root directory
* @param MockInterface|ConfigCache $config The config cache
* @param MockInterface|Config\Configuration $config The config cache
*/
public function mockApp($root, $config)
public function mockApp($root, Config\Configuration $config)
{
$this->configCache = $config;
// Mocking App and most used functions
@ -62,11 +61,14 @@ trait AppMockTrait
->andReturn('localhost');
$config
->shouldReceive('get')
->with('system', 'theme', NULL)
->with('system', 'theme', NULL, false)
->andReturn('system_theme');
$config
->shouldReceive('getConfig')
->andReturn($config);
$this->app
->shouldReceive('getConfig')
->shouldReceive('getConfigCache')
->andReturn($config);
$this->app
@ -84,11 +86,6 @@ trait AppMockTrait
// Initialize empty Config
Config::init($config);
$configAdapter = \Mockery::mock('Friendica\Core\Config\IConfigAdapter');
$configAdapter
->shouldReceive('isConnected')
->andReturn(false);
Config::setAdapter($configAdapter);
BaseObject::setApp($this->app);
}