mirror of
https://github.com/friendica/friendica
synced 2025-04-27 18:30:12 +00:00
Creating interfaces for Config/PConfig & fix tests
This commit is contained in:
parent
4835f1185f
commit
c1dbb25656
54 changed files with 349 additions and 285 deletions
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Test\src\Core\Cache;
|
||||
|
||||
use Friendica\Core\Cache\MemcacheCache;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
|
||||
/**
|
||||
* @requires extension memcache
|
||||
|
@ -13,7 +13,7 @@ class MemcacheCacheTest extends MemoryCacheTest
|
|||
{
|
||||
protected function getInstance()
|
||||
{
|
||||
$configMock = \Mockery::mock(Configuration::class);
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
|
||||
$host = $_SERVER['MEMCACHE_HOST'] ?? 'localhost';
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace Friendica\Test\src\Core\Cache;
|
||||
|
||||
use Friendica\Core\Cache\MemcachedCache;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Psr\Log\NullLogger;
|
||||
|
||||
/**
|
||||
|
@ -15,7 +15,7 @@ class MemcachedCacheTest extends MemoryCacheTest
|
|||
{
|
||||
protected function getInstance()
|
||||
{
|
||||
$configMock = \Mockery::mock(Configuration::class);
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
|
||||
$host = $_SERVER['MEMCACHED_HOST'] ?? 'localhost';
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace Friendica\Test\src\Core\Cache;
|
||||
|
||||
use Friendica\Core\Cache\RedisCache;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
|
||||
/**
|
||||
* @requires extension redis
|
||||
|
@ -14,7 +14,7 @@ class RedisCacheTest extends MemoryCacheTest
|
|||
{
|
||||
protected function getInstance()
|
||||
{
|
||||
$configMock = \Mockery::mock(Configuration::class);
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
|
||||
$host = $_SERVER['REDIS_HOST'] ?? 'localhost';
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
namespace Friendica\Test\src\Core\Config;
|
||||
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Friendica\Core\Config\JitConfiguration;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Model\Config\Config as ConfigModel;
|
||||
use Friendica\Test\MockedTest;
|
||||
use Mockery\MockInterface;
|
||||
|
@ -18,7 +17,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
/** @var ConfigCache */
|
||||
protected $configCache;
|
||||
|
||||
/** @var Configuration */
|
||||
/** @var IConfiguration */
|
||||
protected $testedConfig;
|
||||
|
||||
/**
|
||||
|
@ -47,7 +46,7 @@ abstract class ConfigurationTest extends MockedTest
|
|||
}
|
||||
|
||||
/**
|
||||
* @return Configuration
|
||||
* @return IConfiguration
|
||||
*/
|
||||
public abstract function getInstance();
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class InstallerTest extends MockedTest
|
|||
$dice = $dice->addRules(include __DIR__ . '/../../../static/dependencies.config.php');
|
||||
|
||||
$dice->shouldReceive('create')
|
||||
->with(\Friendica\Core\L10n\L10n::class)
|
||||
->with(\Friendica\Core\L10n\L10n::class, [])
|
||||
->andReturn($this->l10nMock);
|
||||
|
||||
DI::init($dice);
|
||||
|
@ -362,7 +362,7 @@ class InstallerTest extends MockedTest
|
|||
$this->assertTrue($install->checkImagick());
|
||||
|
||||
$this->assertCheckExist(1,
|
||||
L10n::t('ImageMagick supports GIF'),
|
||||
$this->l10nMock->t('ImageMagick supports GIF'),
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
|
@ -385,9 +385,9 @@ class InstallerTest extends MockedTest
|
|||
// even there is no supported type, Imagick should return true (because it is not required)
|
||||
$this->assertTrue($install->checkImagick());
|
||||
$this->assertCheckExist(1,
|
||||
L10n::t('ImageMagick supports GIF'),
|
||||
$this->l10nMock->t('ImageMagick supports GIF'),
|
||||
'',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
$install->getChecks());
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace Friendica\Test\src\Core\Lock;
|
||||
|
||||
use Friendica\Core\Cache\MemcacheCache;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Lock\CacheLock;
|
||||
|
||||
/**
|
||||
|
@ -15,7 +15,7 @@ class MemcacheCacheLockTest extends LockTest
|
|||
{
|
||||
protected function getInstance()
|
||||
{
|
||||
$configMock = \Mockery::mock(Configuration::class);
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
|
||||
$host = $_SERVER['MEMCACHE_HOST'] ?? 'localhost';
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace Friendica\Test\src\Core\Lock;
|
||||
|
||||
use Friendica\Core\Cache\MemcachedCache;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Lock\CacheLock;
|
||||
use Psr\Log\NullLogger;
|
||||
|
||||
|
@ -16,7 +16,7 @@ class MemcachedCacheLockTest extends LockTest
|
|||
{
|
||||
protected function getInstance()
|
||||
{
|
||||
$configMock = \Mockery::mock(Configuration::class);
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
|
||||
$host = $_SERVER['MEMCACHED_HOST'] ?? 'localhost';
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace Friendica\Test\src\Core\Lock;
|
||||
|
||||
use Friendica\Core\Cache\RedisCache;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Lock\CacheLock;
|
||||
|
||||
/**
|
||||
|
@ -15,7 +15,7 @@ class RedisCacheLockTest extends LockTest
|
|||
{
|
||||
protected function getInstance()
|
||||
{
|
||||
$configMock = \Mockery::mock(Configuration::class);
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
|
||||
$host = $_SERVER['REDIS_HOST'] ?? 'localhost';
|
||||
|
||||
|
|
|
@ -4,27 +4,29 @@ namespace Friendica\Test\src\Core\Lock;
|
|||
|
||||
use Dice\Dice;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\JitConfiguration;
|
||||
use Friendica\Core\Lock\SemaphoreLock;
|
||||
use Friendica\DI;
|
||||
use Mockery\MockInterface;
|
||||
|
||||
class SemaphoreLockTest extends LockTest
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
/** @var MockInterface|Dice $dice */
|
||||
$dice = \Mockery::mock(Dice::class)->makePartial();
|
||||
|
||||
$app = \Mockery::mock(App::class);
|
||||
$app->shouldReceive('getHostname')->andReturn('friendica.local');
|
||||
$dice->shouldReceive('create')->with(App::class)->andReturn($app);
|
||||
$dice->shouldReceive('create')->with(App::class, [])->andReturn($app);
|
||||
|
||||
$configMock = \Mockery::mock(JitConfiguration::class);
|
||||
$configMock
|
||||
->shouldReceive('get')
|
||||
->with('system', 'temppath', NULL, false)
|
||||
->andReturn('/tmp/');
|
||||
$dice->shouldReceive('create')->with(Configuration::class)->andReturn($configMock);
|
||||
$dice->shouldReceive('create')->with(IConfiguration::class, [])->andReturn($configMock);
|
||||
|
||||
// @todo Because "get_temppath()" is using static methods, we have to initialize the BaseObject
|
||||
DI::init($dice);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue