Bugfix ConfigCacheLoaderTest

This commit is contained in:
Philipp Holzer 2019-03-14 02:40:16 +01:00
parent 505d8c18d0
commit 1f8d922345
No known key found for this signature in database
GPG Key ID: 517BE60E2CE5C8A5
1 changed files with 16 additions and 6 deletions

View File

@ -2,21 +2,31 @@
namespace Friendica\Test\Core\Config\Cache; namespace Friendica\Test\Core\Config\Cache;
use Friendica\App;
use Friendica\Core\Config\Cache\ConfigCache; use Friendica\Core\Config\Cache\ConfigCache;
use Friendica\Core\Config\Cache\ConfigCacheLoader; use Friendica\Core\Config\Cache\ConfigCacheLoader;
use Friendica\Test\MockedTest; use Friendica\Test\MockedTest;
use Friendica\Test\Util\VFSTrait; use Friendica\Test\Util\VFSTrait;
use Mockery\MockInterface;
use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStream;
class ConfigCacheLoaderTest extends MockedTest class ConfigCacheLoaderTest extends MockedTest
{ {
use VFSTrait; use VFSTrait;
/**
* @var App\Mode|MockInterface
*/
private $mode;
protected function setUp() protected function setUp()
{ {
parent::setUp(); parent::setUp();
$this->setUpVfsDir(); $this->setUpVfsDir();
$this->mode = \Mockery::mock(App\Mode::class);
$this->mode->shouldReceive('isInstall')->andReturn(true);
} }
/** /**
@ -24,7 +34,7 @@ class ConfigCacheLoaderTest extends MockedTest
*/ */
public function testLoadConfigFiles() public function testLoadConfigFiles()
{ {
$configCacheLoader = new ConfigCacheLoader($this->root->url()); $configCacheLoader = new ConfigCacheLoader($this->root->url(), $this->mode);
$configCache = new ConfigCache(); $configCache = new ConfigCache();
$configCacheLoader->loadConfigFiles($configCache); $configCacheLoader->loadConfigFiles($configCache);
@ -45,7 +55,7 @@ class ConfigCacheLoaderTest extends MockedTest
->at($this->root->getChild('config')) ->at($this->root->getChild('config'))
->setContent('<?php return true;'); ->setContent('<?php return true;');
$configCacheLoader = new ConfigCacheLoader($this->root->url()); $configCacheLoader = new ConfigCacheLoader($this->root->url(), $this->mode);
$configCache = new ConfigCache(); $configCache = new ConfigCache();
$configCacheLoader->loadConfigFiles($configCache); $configCacheLoader->loadConfigFiles($configCache);
@ -70,7 +80,7 @@ class ConfigCacheLoaderTest extends MockedTest
->at($this->root->getChild('config')) ->at($this->root->getChild('config'))
->setContent(file_get_contents($file)); ->setContent(file_get_contents($file));
$configCacheLoader = new ConfigCacheLoader($this->root->url()); $configCacheLoader = new ConfigCacheLoader($this->root->url(), $this->mode);
$configCache = new ConfigCache(); $configCache = new ConfigCache();
$configCacheLoader->loadConfigFiles($configCache); $configCacheLoader->loadConfigFiles($configCache);
@ -103,7 +113,7 @@ class ConfigCacheLoaderTest extends MockedTest
->at($this->root->getChild('config')) ->at($this->root->getChild('config'))
->setContent(file_get_contents($file)); ->setContent(file_get_contents($file));
$configCacheLoader = new ConfigCacheLoader($this->root->url()); $configCacheLoader = new ConfigCacheLoader($this->root->url(), $this->mode);
$configCache = new ConfigCache(); $configCache = new ConfigCache();
$configCacheLoader->loadConfigFiles($configCache); $configCacheLoader->loadConfigFiles($configCache);
@ -135,7 +145,7 @@ class ConfigCacheLoaderTest extends MockedTest
->at($this->root) ->at($this->root)
->setContent(file_get_contents($file)); ->setContent(file_get_contents($file));
$configCacheLoader = new ConfigCacheLoader($this->root->url()); $configCacheLoader = new ConfigCacheLoader($this->root->url(), $this->mode);
$configCache = new ConfigCache(); $configCache = new ConfigCache();
$configCacheLoader->loadConfigFiles($configCache); $configCacheLoader->loadConfigFiles($configCache);
@ -174,7 +184,7 @@ class ConfigCacheLoaderTest extends MockedTest
->at($this->root->getChild('addon')->getChild('test')->getChild('config')) ->at($this->root->getChild('addon')->getChild('test')->getChild('config'))
->setContent(file_get_contents($file)); ->setContent(file_get_contents($file));
$configCacheLoader = new ConfigCacheLoader($this->root->url()); $configCacheLoader = new ConfigCacheLoader($this->root->url(), $this->mode);
$conf = $configCacheLoader->loadAddonConfig('test'); $conf = $configCacheLoader->loadAddonConfig('test');