X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=tests%2Fsrc%2FCore%2FConfig%2FPConfigurationTest.php;h=f2f1857a69b9667daed508d061f05b26bcd92a12;hb=7ce48d1b77e9a691b1f77ec01690175f6b27bda9;hp=8ecc9bdf379f092ff38ba0a3f87103ae71cf3bf9;hpb=e1d9d67632a8d6777a2b49c227b7a40d1014437c;p=friendica.git diff --git a/tests/src/Core/Config/PConfigurationTest.php b/tests/src/Core/Config/PConfigurationTest.php index 8ecc9bdf37..f2f1857a69 100644 --- a/tests/src/Core/Config/PConfigurationTest.php +++ b/tests/src/Core/Config/PConfigurationTest.php @@ -1,8 +1,9 @@ shouldReceive('isConnected')->andReturn(true)->twice(); // expected loading $configAdapter->shouldReceive('load') @@ -50,8 +51,8 @@ class PConfigurationTest extends MockedTest public function testCacheLoadDouble() { $uid = 234; - $configCache = new ConfigCache(); - $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IPConfigAdapter'); + $configCache = new PConfigCache(); + $configAdapter = \Mockery::mock(IPConfigAdapter::class); $configAdapter->shouldReceive('isConnected')->andReturn(true)->times(4); // expected loading $configAdapter->shouldReceive('load')->with($uid, 'testing')->andReturn(['testing' => ['test' => 'it']])->once(); @@ -76,8 +77,8 @@ class PConfigurationTest extends MockedTest public function testSetGetWithoutDB($data) { $uid = 234; - $configCache = new ConfigCache(); - $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IPConfigAdapter'); + $configCache = new PConfigCache(); + $configAdapter = \Mockery::mock(IPConfigAdapter::class); $configAdapter->shouldReceive('isConnected')->andReturn(false)->times(2); $configuration = new PConfiguration($configCache, $configAdapter); @@ -94,8 +95,8 @@ class PConfigurationTest extends MockedTest public function testSetGetWithDB($data) { $uid = 234; - $configCache = new ConfigCache(); - $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IPConfigAdapter'); + $configCache = new PConfigCache(); + $configAdapter = \Mockery::mock(IPConfigAdapter::class); $configAdapter->shouldReceive('isConnected')->andReturn(true)->times(2); $configAdapter->shouldReceive('isLoaded')->with($uid, 'test', 'it')->andReturn(true)->once(); $configAdapter->shouldReceive('set')->with($uid, 'test', 'it', $data)->andReturn(true)->once(); @@ -113,8 +114,8 @@ class PConfigurationTest extends MockedTest public function testGetWrongWithoutDB() { $uid = 234; - $configCache = new ConfigCache(); - $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IPConfigAdapter'); + $configCache = new PConfigCache(); + $configAdapter = \Mockery::mock(IPConfigAdapter::class); $configAdapter->shouldReceive('isConnected')->andReturn(false)->times(3); $configuration = new PConfiguration($configCache, $configAdapter); @@ -136,15 +137,15 @@ class PConfigurationTest extends MockedTest public function testGetWithRefresh($data) { $uid = 234; - $configCache = new ConfigCache(); - $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IPConfigAdapter'); + $configCache = new PConfigCache(); + $configAdapter = \Mockery::mock(IPConfigAdapter::class); $configAdapter->shouldReceive('isConnected')->andReturn(true)->times(4); $configAdapter->shouldReceive('isLoaded')->with($uid, 'test', 'it')->andReturn(false)->once(); $configAdapter->shouldReceive('get')->with($uid, 'test', 'it')->andReturn('now')->once(); $configAdapter->shouldReceive('isLoaded')->with($uid, 'test', 'it')->andReturn(true)->twice(); $configAdapter->shouldReceive('get')->with($uid, 'test', 'it')->andReturn($data)->once(); $configAdapter->shouldReceive('isLoaded')->with($uid, 'test', 'not')->andReturn(false)->once(); - $configAdapter->shouldReceive('get')->with($uid, 'test', 'not')->andReturn('!!')->once(); + $configAdapter->shouldReceive('get')->with($uid, 'test', 'not')->andReturn(null)->once(); $configuration = new PConfiguration($configCache, $configAdapter); @@ -167,12 +168,12 @@ class PConfigurationTest extends MockedTest public function testGetWithoutLoaded($data) { $uid = 234; - $configCache = new ConfigCache(); - $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IPConfigAdapter'); + $configCache = new PConfigCache(); + $configAdapter = \Mockery::mock(IPConfigAdapter::class); $configAdapter->shouldReceive('isConnected')->andReturn(true)->times(3); $configAdapter->shouldReceive('isLoaded')->with($uid, 'test', 'it')->andReturn(false)->once(); - $configAdapter->shouldReceive('get')->with($uid, 'test', 'it')->andReturn('!!')->once(); + $configAdapter->shouldReceive('get')->with($uid, 'test', 'it')->andReturn(null)->once(); $configAdapter->shouldReceive('isLoaded')->with($uid, 'test', 'it')->andReturn(false)->once(); $configAdapter->shouldReceive('get')->with($uid, 'test', 'it')->andReturn($data)->once(); @@ -198,8 +199,8 @@ class PConfigurationTest extends MockedTest public function testDeleteWithoutDB($data) { $uid = 234; - $configCache = new ConfigCache(); - $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IPConfigAdapter'); + $configCache = new PConfigCache(); + $configAdapter = \Mockery::mock(IPConfigAdapter::class); $configAdapter->shouldReceive('isConnected')->andReturn(false)->times(4); $configuration = new PConfiguration($configCache, $configAdapter); @@ -217,8 +218,8 @@ class PConfigurationTest extends MockedTest public function testDeleteWithDB() { $uid = 234; - $configCache = new ConfigCache(); - $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IPConfigAdapter'); + $configCache = new PConfigCache(); + $configAdapter = \Mockery::mock(IPConfigAdapter::class); $configAdapter->shouldReceive('isConnected')->andReturn(true)->times(6); $configAdapter->shouldReceive('set')->with($uid, 'test', 'it', 'now')->andReturn(false)->once(); $configAdapter->shouldReceive('isLoaded')->with($uid, 'test', 'it')->andReturn(true)->once();