Shorten "PConfiguration" to "PConfig" again, since the Wrapper is gone
This commit is contained in:
parent
cb80108957
commit
d5a473abda
41 changed files with 219 additions and 216 deletions
|
|
@ -52,9 +52,9 @@ trait AppMockTrait
|
|||
$this->dice = \Mockery::mock(Dice::class)->makePartial();
|
||||
$this->dice = $this->dice->addRules(include __DIR__ . '/../../static/dependencies.config.php');
|
||||
|
||||
$this->configMock = \Mockery::mock(Config\Cache\ConfigCache::class);
|
||||
$this->configMock = \Mockery::mock(Config\Cache::class);
|
||||
$this->dice->shouldReceive('create')
|
||||
->with(Config\Cache\ConfigCache::class)
|
||||
->with(Config\Cache::class)
|
||||
->andReturn($this->configMock);
|
||||
$this->mode = \Mockery::mock(App\Mode::class);
|
||||
$this->dice->shouldReceive('create')
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use Dice\Dice;
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Cache\ICache;
|
||||
use Friendica\Core\Cache\IMemoryCache;
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\Lock\ILock;
|
||||
use Friendica\Database\Database;
|
||||
|
|
@ -59,7 +59,7 @@ class dependencyCheck extends TestCase
|
|||
|
||||
$this->assertInstanceOf(ConfigFileLoader::class, $configFileLoader);
|
||||
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
$configFileLoader->setupCache($configCache);
|
||||
|
||||
$this->assertNotEmpty($configCache->getAll());
|
||||
|
|
@ -77,7 +77,7 @@ class dependencyCheck extends TestCase
|
|||
|
||||
$this->assertInstanceOf(Profiler::class, $profiler);
|
||||
|
||||
$configCache = new ConfigCache([
|
||||
$configCache = new Cache([
|
||||
'system' => [
|
||||
'profiler' => true,
|
||||
],
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace Friendica\Test;
|
|||
use Dice\Dice;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Core\Config\IPConfiguration;
|
||||
use Friendica\Core\PConfig\IPConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\Session\ISession;
|
||||
|
|
@ -827,7 +827,7 @@ class ApiTest extends DatabaseTest
|
|||
*/
|
||||
public function testApiGetUserWithFrioSchema()
|
||||
{
|
||||
$pConfig = $this->dice->create(IPConfiguration::class);
|
||||
$pConfig = $this->dice->create(IPConfig::class);
|
||||
$pConfig->set($this->selfUser['id'], 'frio', 'schema', 'red');
|
||||
$user = api_get_user($this->app);
|
||||
$this->assertSelfUser($user);
|
||||
|
|
@ -843,7 +843,7 @@ class ApiTest extends DatabaseTest
|
|||
*/
|
||||
public function testApiGetUserWithCustomFrioSchema()
|
||||
{
|
||||
$pConfig = $this->dice->create(IPConfiguration::class);
|
||||
$pConfig = $this->dice->create(IPConfig::class);
|
||||
$pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
|
||||
$pConfig->set($this->selfUser['id'], 'frio', 'nav_bg', '#123456');
|
||||
$pConfig->set($this->selfUser['id'], 'frio', 'link_color', '#123456');
|
||||
|
|
@ -862,7 +862,7 @@ class ApiTest extends DatabaseTest
|
|||
*/
|
||||
public function testApiGetUserWithEmptyFrioSchema()
|
||||
{
|
||||
$pConfig = $this->dice->create(IPConfiguration::class);
|
||||
$pConfig = $this->dice->create(IPConfig::class);
|
||||
$pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
|
||||
$user = api_get_user($this->app);
|
||||
$this->assertSelfUser($user);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class ModeTest extends MockedTest
|
|||
private $databaseMock;
|
||||
|
||||
/**
|
||||
* @var Config\Cache\ConfigCache|MockInterface
|
||||
* @var \Friendica\Core\Config\Cache|MockInterface
|
||||
*/
|
||||
private $configCacheMock;
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ class ModeTest extends MockedTest
|
|||
|
||||
$this->basePathMock = \Mockery::mock(BasePath::class);
|
||||
$this->databaseMock = \Mockery::mock(Database::class);
|
||||
$this->configCacheMock = \Mockery::mock(Config\Cache\ConfigCache::class);
|
||||
$this->configCacheMock = \Mockery::mock(Config\Cache::class);
|
||||
}
|
||||
|
||||
public function testItEmpty()
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Friendica\Test\src\Console;
|
|||
use Dice\Dice;
|
||||
use Friendica\App;
|
||||
use Friendica\Console\AutomaticInstallation;
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Core\Installer;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
|
|
@ -37,7 +37,7 @@ class AutomaticInstallationConsoleTest extends ConsoleTest
|
|||
private $assertFileDb;
|
||||
|
||||
/**
|
||||
* @var ConfigCache The configuration cache to check after each test
|
||||
* @var Cache The configuration cache to check after each test
|
||||
*/
|
||||
private $configCache;
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ class AutomaticInstallationConsoleTest extends ConsoleTest
|
|||
|
||||
DI::init($this->dice);
|
||||
|
||||
$this->configCache = new ConfigCache();
|
||||
$this->configCache = new Cache();
|
||||
$this->configCache->set('system', 'basepath', $this->root->url());
|
||||
$this->configCache->set('config', 'php_path', trim(shell_exec('which php')));
|
||||
$this->configCache->set('system', 'theme', 'smarty3');
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Friendica\Test\src\Core\Config\Cache;
|
||||
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Test\MockedTest;
|
||||
use ParagonIE\HiddenString\HiddenString;
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ class ConfigCacheTest extends MockedTest
|
|||
];
|
||||
}
|
||||
|
||||
private function assertConfigValues($data, ConfigCache $configCache)
|
||||
private function assertConfigValues($data, Cache $configCache)
|
||||
{
|
||||
foreach ($data as $cat => $values) {
|
||||
foreach ($values as $key => $value) {
|
||||
|
|
@ -44,7 +44,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testLoadConfigArray($data)
|
||||
{
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
$configCache->load($data);
|
||||
|
||||
$this->assertConfigValues($data, $configCache);
|
||||
|
|
@ -63,7 +63,7 @@ class ConfigCacheTest extends MockedTest
|
|||
]
|
||||
];
|
||||
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
$configCache->load($data);
|
||||
$configCache->load($override);
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testLoadConfigArrayWrong()
|
||||
{
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
// empty dataset
|
||||
$configCache->load([]);
|
||||
|
|
@ -102,7 +102,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testGetAll($data)
|
||||
{
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
$configCache->load($data);
|
||||
|
||||
$all = $configCache->getAll();
|
||||
|
|
@ -117,7 +117,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testSetGet($data)
|
||||
{
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
foreach ($data as $cat => $values) {
|
||||
foreach ($values as $key => $value) {
|
||||
|
|
@ -133,7 +133,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testGetEmpty()
|
||||
{
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$this->assertNull($configCache->get('something', 'value'));
|
||||
}
|
||||
|
|
@ -143,7 +143,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testGetCat()
|
||||
{
|
||||
$configCache = new ConfigCache([
|
||||
$configCache = new Cache([
|
||||
'system' => [
|
||||
'key1' => 'value1',
|
||||
'key2' => 'value2',
|
||||
|
|
@ -171,7 +171,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testDelete($data)
|
||||
{
|
||||
$configCache = new ConfigCache($data);
|
||||
$configCache = new Cache($data);
|
||||
|
||||
foreach ($data as $cat => $values) {
|
||||
foreach ($values as $key => $value) {
|
||||
|
|
@ -188,7 +188,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testKeyDiffWithResult($data)
|
||||
{
|
||||
$configCache = new ConfigCache($data);
|
||||
$configCache = new Cache($data);
|
||||
|
||||
$diffConfig = [
|
||||
'fakeCat' => [
|
||||
|
|
@ -205,7 +205,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testKeyDiffWithoutResult($data)
|
||||
{
|
||||
$configCache = new ConfigCache($data);
|
||||
$configCache = new Cache($data);
|
||||
|
||||
$diffConfig = $configCache->getAll();
|
||||
|
||||
|
|
@ -217,7 +217,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testPasswordHide()
|
||||
{
|
||||
$configCache = new ConfigCache([
|
||||
$configCache = new Cache([
|
||||
'database' => [
|
||||
'password' => 'supersecure',
|
||||
'username' => 'notsecured',
|
||||
|
|
@ -234,7 +234,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testPasswordShow()
|
||||
{
|
||||
$configCache = new ConfigCache([
|
||||
$configCache = new Cache([
|
||||
'database' => [
|
||||
'password' => 'supersecure',
|
||||
'username' => 'notsecured',
|
||||
|
|
@ -251,7 +251,7 @@ class ConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testEmptyPassword()
|
||||
{
|
||||
$configCache = new ConfigCache([
|
||||
$configCache = new Cache([
|
||||
'database' => [
|
||||
'password' => '',
|
||||
'username' => '',
|
||||
|
|
@ -265,7 +265,7 @@ class ConfigCacheTest extends MockedTest
|
|||
|
||||
public function testWrongTypePassword()
|
||||
{
|
||||
$configCache = new ConfigCache([
|
||||
$configCache = new Cache([
|
||||
'database' => [
|
||||
'password' => new \stdClass(),
|
||||
'username' => '',
|
||||
|
|
@ -275,7 +275,7 @@ class ConfigCacheTest extends MockedTest
|
|||
$this->assertNotEmpty($configCache->get('database', 'password'));
|
||||
$this->assertEmpty($configCache->get('database', 'username'));
|
||||
|
||||
$configCache = new ConfigCache([
|
||||
$configCache = new Cache([
|
||||
'database' => [
|
||||
'password' => 23,
|
||||
'username' => '',
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Friendica\Test\src\Core\Config\Cache;
|
||||
|
||||
use Friendica\Core\Config\Cache\PConfigCache;
|
||||
use Friendica\Core\PConfig\Cache;
|
||||
use Friendica\Test\MockedTest;
|
||||
|
||||
class PConfigCacheTest extends MockedTest
|
||||
|
|
@ -28,7 +28,7 @@ class PConfigCacheTest extends MockedTest
|
|||
];
|
||||
}
|
||||
|
||||
private function assertConfigValues($data, PConfigCache $configCache, $uid)
|
||||
private function assertConfigValues($data, Cache $configCache, $uid)
|
||||
{
|
||||
foreach ($data as $cat => $values) {
|
||||
foreach ($values as $key => $value) {
|
||||
|
|
@ -44,7 +44,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testSetGet($data)
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
$uid = 345;
|
||||
|
||||
foreach ($data as $cat => $values) {
|
||||
|
|
@ -62,7 +62,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testGetCat()
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
$uid = 345;
|
||||
|
||||
$configCache->load($uid, [
|
||||
|
|
@ -94,7 +94,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testDelete($data)
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
$uid = 345;
|
||||
|
||||
foreach ($data as $cat => $values) {
|
||||
|
|
@ -119,7 +119,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testKeyDiffWithResult($data)
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$diffConfig = [
|
||||
'fakeCat' => [
|
||||
|
|
@ -137,7 +137,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testKeyDiffWithoutResult($data)
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configCache->load(1, $data);
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testPasswordHide()
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configCache->load(1, [
|
||||
'database' => [
|
||||
|
|
@ -170,7 +170,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testPasswordShow()
|
||||
{
|
||||
$configCache = new PConfigCache(false);
|
||||
$configCache = new Cache(false);
|
||||
|
||||
$configCache->load(1, [
|
||||
'database' => [
|
||||
|
|
@ -189,7 +189,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testEmptyPassword()
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configCache->load(1, [
|
||||
'database' => [
|
||||
|
|
@ -204,7 +204,7 @@ class PConfigCacheTest extends MockedTest
|
|||
|
||||
public function testWrongTypePassword()
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configCache->load(1, [
|
||||
'database' => [
|
||||
|
|
@ -216,7 +216,7 @@ class PConfigCacheTest extends MockedTest
|
|||
$this->assertNotEmpty($configCache->get(1, 'database', 'password'));
|
||||
$this->assertEmpty($configCache->get(1, 'database', 'username'));
|
||||
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configCache->load(1, [
|
||||
'database' => [
|
||||
|
|
@ -234,7 +234,7 @@ class PConfigCacheTest extends MockedTest
|
|||
*/
|
||||
public function testTwoUid()
|
||||
{
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configCache->load(1, [
|
||||
'cat1' => [
|
||||
|
|
@ -265,7 +265,7 @@ class PConfigCacheTest extends MockedTest
|
|||
// bad UID!
|
||||
$uid = null;
|
||||
|
||||
$configCache = new PConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$this->assertNull($configCache->get($uid, 'cat1', 'cat2'));
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Friendica\Test\src\Core\Config;
|
||||
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Model\Config\Config as ConfigModel;
|
||||
use Friendica\Test\MockedTest;
|
||||
|
|
@ -14,7 +14,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
/** @var ConfigModel|MockInterface */
|
||||
protected $configModel;
|
||||
|
||||
/** @var ConfigCache */
|
||||
/** @var Cache */
|
||||
protected $configCache;
|
||||
|
||||
/** @var IConfig */
|
||||
|
|
@ -42,7 +42,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
|
||||
// Create the config model
|
||||
$this->configModel = Mockery::mock(ConfigModel::class);
|
||||
$this->configCache = new ConfigCache();
|
||||
$this->configCache = new Cache();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -142,7 +142,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
->once();
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
// assert config is loaded everytime
|
||||
$this->assertConfig('config', $data['config']);
|
||||
|
|
@ -154,7 +154,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
public function testLoad(array $data, array $possibleCats, array $load)
|
||||
{
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
foreach ($load as $loadedCats) {
|
||||
$this->testedConfig->load($loadedCats);
|
||||
|
|
@ -235,7 +235,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
public function testCacheLoadDouble(array $data1, array $data2, array $expect)
|
||||
{
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
foreach ($data1 as $cat => $data) {
|
||||
$this->testedConfig->load($cat);
|
||||
|
|
@ -260,7 +260,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
$this->configModel->shouldReceive('load')->withAnyArgs()->andReturn([])->once();
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertEmpty($this->testedConfig->getCache()->getAll());
|
||||
}
|
||||
|
|
@ -277,7 +277,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
->times(3);
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertTrue($this->testedConfig->set('test', 'it', $data));
|
||||
|
||||
|
|
@ -295,7 +295,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
$this->configModel->shouldReceive('set')->with('test', 'it', $data)->andReturn(true)->once();
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertTrue($this->testedConfig->set('test', 'it', $data));
|
||||
|
||||
|
|
@ -309,7 +309,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
public function testGetWrongWithoutDB()
|
||||
{
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
// without refresh
|
||||
$this->assertNull($this->testedConfig->get('test', 'it'));
|
||||
|
|
@ -334,7 +334,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
$this->configCache->load(['test' => ['it' => 'now']]);
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
// without refresh
|
||||
$this->assertEquals('now', $this->testedConfig->get('test', 'it'));
|
||||
|
|
@ -359,7 +359,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
$this->configCache->load(['test' => ['it' => $data]]);
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertEquals($data, $this->testedConfig->get('test', 'it'));
|
||||
$this->assertEquals($data, $this->testedConfig->getCache()->get('test', 'it'));
|
||||
|
|
@ -396,7 +396,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
->once();
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
// directly set the value to the cache
|
||||
$this->testedConfig->getCache()->set('test', 'it', 'now');
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
namespace Friendica\Test\src\Core\Config;
|
||||
|
||||
use Friendica\Core\Config\JitPConfiguration;
|
||||
use Friendica\Core\PConfig\JitPConfig;
|
||||
|
||||
class JitPConfigurationTest extends PConfigurationTest
|
||||
{
|
||||
public function getInstance()
|
||||
{
|
||||
return new JitPConfiguration($this->configCache, $this->configModel);
|
||||
return new JitPConfig($this->configCache, $this->configModel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace Friendica\Test\src\Core\Config;
|
||||
|
||||
use Friendica\Core\Config\Cache\PConfigCache;
|
||||
use Friendica\Core\Config\PConfiguration;
|
||||
use Friendica\Core\PConfig\Cache;
|
||||
use Friendica\Core\BasePConfig;
|
||||
use Friendica\Model\Config\PConfig as PConfigModel;
|
||||
use Friendica\Test\MockedTest;
|
||||
use Mockery;
|
||||
|
|
@ -14,10 +14,10 @@ abstract class PConfigurationTest extends MockedTest
|
|||
/** @var PConfigModel|MockInterface */
|
||||
protected $configModel;
|
||||
|
||||
/** @var PConfigCache */
|
||||
/** @var Cache */
|
||||
protected $configCache;
|
||||
|
||||
/** @var PConfiguration */
|
||||
/** @var BasePConfig */
|
||||
protected $testedConfig;
|
||||
|
||||
/**
|
||||
|
|
@ -44,11 +44,11 @@ abstract class PConfigurationTest extends MockedTest
|
|||
|
||||
// Create the config model
|
||||
$this->configModel = Mockery::mock(PConfigModel::class);
|
||||
$this->configCache = new PConfigCache();
|
||||
$this->configCache = new Cache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PConfiguration
|
||||
* @return BasePConfig
|
||||
*/
|
||||
public abstract function getInstance();
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
public function testSetUp(int $uid, array $data)
|
||||
{
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertEmpty($this->testedConfig->getCache()->getAll());
|
||||
}
|
||||
|
|
@ -156,7 +156,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
public function testLoad(int $uid, array $data, array $possibleCats, array $load)
|
||||
{
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
foreach ($load as $loadedCats) {
|
||||
$this->testedConfig->load($uid, $loadedCats);
|
||||
|
|
@ -239,7 +239,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
public function testCacheLoadDouble(int $uid, array $data1, array $data2, array $expect)
|
||||
{
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
foreach ($data1 as $cat => $data) {
|
||||
$this->testedConfig->load($uid, $cat);
|
||||
|
|
@ -263,7 +263,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
public function testSetGetWithoutDB(int $uid, $data)
|
||||
{
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertTrue($this->testedConfig->set($uid, 'test', 'it', $data));
|
||||
|
||||
|
|
@ -284,7 +284,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
->once();
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertTrue($this->testedConfig->set($uid, 'test', 'it', $data));
|
||||
|
||||
|
|
@ -298,7 +298,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
public function testGetWrongWithoutDB()
|
||||
{
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
// without refresh
|
||||
$this->assertNull($this->testedConfig->get(0, 'test', 'it'));
|
||||
|
|
@ -323,7 +323,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
$this->configCache->load($uid, ['test' => ['it' => 'now']]);
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
// without refresh
|
||||
$this->assertEquals('now', $this->testedConfig->get($uid, 'test', 'it'));
|
||||
|
|
@ -348,7 +348,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
$this->configCache->load($uid, ['test' => ['it' => $data]]);
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertEquals($data, $this->testedConfig->get($uid, 'test', 'it'));
|
||||
$this->assertEquals($data, $this->testedConfig->getCache()->get($uid, 'test', 'it'));
|
||||
|
|
@ -387,7 +387,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
->once();
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
// directly set the value to the cache
|
||||
$this->testedConfig->getCache()->set($uid, 'test', 'it', 'now');
|
||||
|
|
@ -447,7 +447,7 @@ abstract class PConfigurationTest extends MockedTest
|
|||
$this->configCache->load($data2['uid'], $data2['data']);
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(PConfigCache::class, $this->testedConfig->getCache());
|
||||
$this->assertInstanceOf(Cache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertConfig($data1['uid'], 'cat1', $data1['data']['cat1']);
|
||||
$this->assertConfig($data1['uid'], 'cat2', $data1['data']['cat2']);
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
namespace Friendica\Test\src\Core\Config;
|
||||
|
||||
use Friendica\Core\Config\PreloadPConfiguration;
|
||||
use Friendica\Core\PConfig\PreloadPConfig;
|
||||
|
||||
class PreloadPConfigurationTest extends PConfigurationTest
|
||||
{
|
||||
public function getInstance()
|
||||
{
|
||||
return new PreloadPConfiguration($this->configCache, $this->configModel);
|
||||
return new PreloadPConfig($this->configCache, $this->configModel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
namespace Friendica\Core;
|
||||
|
||||
use Dice\Dice;
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\CurlResult;
|
||||
use Friendica\Test\MockedTest;
|
||||
|
|
@ -419,7 +419,7 @@ class InstallerTest extends MockedTest
|
|||
$this->l10nMock->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
|
||||
|
||||
$install = new Installer();
|
||||
$configCache = \Mockery::mock(ConfigCache::class);
|
||||
$configCache = \Mockery::mock(Cache::class);
|
||||
$configCache->shouldReceive('set')->with('config', 'php_path', \Mockery::any())->once();
|
||||
$configCache->shouldReceive('set')->with('system', 'basepath', '/test/')->once();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Friendica\Test\src\Util\Config;
|
||||
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Test\MockedTest;
|
||||
use Friendica\Test\Util\VFSTrait;
|
||||
use Friendica\Util\ConfigFileLoader;
|
||||
|
|
@ -27,7 +27,7 @@ class ConfigFileLoaderTest extends MockedTest
|
|||
$this->delConfigFile('local.config.php');
|
||||
|
||||
$configFileLoader = new ConfigFileLoader($this->root->url());
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileLoader->setupCache($configCache);
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ class ConfigFileLoaderTest extends MockedTest
|
|||
->setContent('<?php return true;');
|
||||
|
||||
$configFileLoader = new ConfigFileLoader($this->root->url());
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileLoader->setupCache($configCache);
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ class ConfigFileLoaderTest extends MockedTest
|
|||
->setContent(file_get_contents($file));
|
||||
|
||||
$configFileLoader = new ConfigFileLoader($this->root->url());
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileLoader->setupCache($configCache);
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ class ConfigFileLoaderTest extends MockedTest
|
|||
->setContent(file_get_contents($file));
|
||||
|
||||
$configFileLoader = new ConfigFileLoader($this->root->url());
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileLoader->setupCache($configCache);
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ class ConfigFileLoaderTest extends MockedTest
|
|||
->setContent(file_get_contents($file));
|
||||
|
||||
$configFileLoader = new ConfigFileLoader($this->root->url());
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileLoader->setupCache($configCache);
|
||||
|
||||
|
|
@ -216,7 +216,7 @@ class ConfigFileLoaderTest extends MockedTest
|
|||
->setContent(file_get_contents($fileDir . 'B.config.php'));
|
||||
|
||||
$configFileLoader = new ConfigFileLoader($this->root->url());
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileLoader->setupCache($configCache);
|
||||
|
||||
|
|
@ -245,7 +245,7 @@ class ConfigFileLoaderTest extends MockedTest
|
|||
->setContent(file_get_contents($fileDir . 'B.ini.php'));
|
||||
|
||||
$configFileLoader = new ConfigFileLoader($this->root->url());
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileLoader->setupCache($configCache);
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ class ConfigFileLoaderTest extends MockedTest
|
|||
->setContent(file_get_contents($fileDir . 'B.ini.php'));
|
||||
|
||||
$configFileLoader = new ConfigFileLoader($this->root->url());
|
||||
$configCache = new ConfigCache();
|
||||
$configCache = new Cache();
|
||||
|
||||
$configFileLoader->setupCache($configCache);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Friendica\Test\src\Util;
|
||||
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Core\Config\IConfig;
|
||||
use Friendica\Test\MockedTest;
|
||||
use Friendica\Util\Profiler;
|
||||
|
|
@ -28,7 +28,7 @@ class ProfilerTest extends MockedTest
|
|||
*/
|
||||
public function testSetUp()
|
||||
{
|
||||
$configCache = \Mockery::mock(ConfigCache::class);
|
||||
$configCache = \Mockery::mock(Cache::class);
|
||||
$configCache->shouldReceive('get')
|
||||
->withAnyArgs()
|
||||
->andReturn(true)
|
||||
|
|
@ -103,7 +103,7 @@ class ProfilerTest extends MockedTest
|
|||
*/
|
||||
public function testSaveTimestamp($timestamp, $name, array $functions)
|
||||
{
|
||||
$configCache = \Mockery::mock(ConfigCache::class);
|
||||
$configCache = \Mockery::mock(Cache::class);
|
||||
$configCache->shouldReceive('get')
|
||||
->withAnyArgs()
|
||||
->andReturn(true)
|
||||
|
|
@ -124,7 +124,7 @@ class ProfilerTest extends MockedTest
|
|||
*/
|
||||
public function testReset($timestamp, $name, array $functions)
|
||||
{
|
||||
$configCache = \Mockery::mock(ConfigCache::class);
|
||||
$configCache = \Mockery::mock(Cache::class);
|
||||
$configCache->shouldReceive('get')
|
||||
->withAnyArgs()
|
||||
->andReturn(true)
|
||||
|
|
@ -187,7 +187,7 @@ class ProfilerTest extends MockedTest
|
|||
->shouldReceive('info')
|
||||
->once();
|
||||
|
||||
$configCache = \Mockery::mock(ConfigCache::class);
|
||||
$configCache = \Mockery::mock(Cache::class);
|
||||
$configCache->shouldReceive('get')
|
||||
->withAnyArgs()
|
||||
->andReturn(true)
|
||||
|
|
@ -218,7 +218,7 @@ class ProfilerTest extends MockedTest
|
|||
*/
|
||||
public function testEnableDisable()
|
||||
{
|
||||
$configCache = \Mockery::mock(ConfigCache::class);
|
||||
$configCache = \Mockery::mock(Cache::class);
|
||||
$configCache->shouldReceive('get')
|
||||
->with('system', 'profiler')
|
||||
->andReturn(true)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue