mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-16 20:05:14 +02: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
|
@ -22,7 +22,7 @@ trait AppMockTrait
|
|||
protected $app;
|
||||
|
||||
/**
|
||||
* @var MockInterface|Config\Configuration The mocked Config Cache
|
||||
* @var MockInterface|Config\IConfiguration The mocked Config Cache
|
||||
*/
|
||||
protected $configMock;
|
||||
|
||||
|
@ -54,11 +54,11 @@ trait AppMockTrait
|
|||
|
||||
$this->configMock = \Mockery::mock(Config\Cache\ConfigCache::class);
|
||||
$this->dice->shouldReceive('create')
|
||||
->with(Config\Cache\ConfigCache::class)
|
||||
->with(Config\Cache\ConfigCache::class, [])
|
||||
->andReturn($this->configMock);
|
||||
$this->mode = \Mockery::mock(App\Mode::class);
|
||||
$this->dice->shouldReceive('create')
|
||||
->with(App\Mode::class)
|
||||
->with(App\Mode::class, [])
|
||||
->andReturn($this->mode);
|
||||
$configModel= \Mockery::mock(\Friendica\Model\Config\Config::class);
|
||||
// Disable the adapter
|
||||
|
@ -66,13 +66,13 @@ trait AppMockTrait
|
|||
|
||||
$config = new Config\JitConfiguration($this->configMock, $configModel);
|
||||
$this->dice->shouldReceive('create')
|
||||
->with(Config\Configuration::class)
|
||||
->with(Config\IConfiguration::class, [])
|
||||
->andReturn($config);
|
||||
|
||||
// Mocking App and most used functions
|
||||
$this->app = \Mockery::mock(App::class);
|
||||
$this->dice->shouldReceive('create')
|
||||
->with(App::class)
|
||||
->with(App::class, [])
|
||||
->andReturn($this->app);
|
||||
$this->app
|
||||
->shouldReceive('getBasePath')
|
||||
|
@ -85,7 +85,7 @@ trait AppMockTrait
|
|||
$this->profilerMock = \Mockery::mock(Profiler::class);
|
||||
$this->profilerMock->shouldReceive('saveTimestamp');
|
||||
$this->dice->shouldReceive('create')
|
||||
->with(Profiler::class)
|
||||
->with(Profiler::class, [])
|
||||
->andReturn($this->profilerMock);
|
||||
|
||||
$this->app
|
||||
|
|
|
@ -3,9 +3,16 @@
|
|||
* This file is loaded by PHPUnit before any test.
|
||||
*/
|
||||
|
||||
use Dice\Dice;
|
||||
use Friendica\DI;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
// Backward compatibility
|
||||
if (!class_exists(TestCase::class)) {
|
||||
class_alias(PHPUnit_Framework_TestCase::class, TestCase::class);
|
||||
}
|
||||
|
||||
$dice = new Dice();
|
||||
$dice = $dice->addRules(include __DIR__ . '/../static/dependencies.config.php');
|
||||
|
||||
DI::init($dice);
|
||||
|
|
|
@ -7,7 +7,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Cache\ICache;
|
||||
use Friendica\Core\Cache\IMemoryCache;
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Lock\ILock;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Test\Util\VFSTrait;
|
||||
|
@ -115,10 +115,10 @@ class dependencyCheck extends TestCase
|
|||
|
||||
public function testConfiguration()
|
||||
{
|
||||
/** @var Configuration $config */
|
||||
$config = $this->dice->create(Configuration::class);
|
||||
/** @var IConfiguration $config */
|
||||
$config = $this->dice->create(IConfiguration::class);
|
||||
|
||||
$this->assertInstanceOf(Configuration::class, $config);
|
||||
$this->assertInstanceOf(IConfiguration::class, $config);
|
||||
|
||||
$this->assertNotEmpty($config->get('database', 'username'));
|
||||
}
|
||||
|
@ -133,8 +133,8 @@ class dependencyCheck extends TestCase
|
|||
|
||||
public function testDevLogger()
|
||||
{
|
||||
/** @var Configuration $config */
|
||||
$config = $this->dice->create(Configuration::class);
|
||||
/** @var IConfiguration $config */
|
||||
$config = $this->dice->create(IConfiguration::class);
|
||||
$config->set('system', 'dlogfile', $this->root->url() . '/friendica.log');
|
||||
|
||||
/** @var LoggerInterface $logger */
|
||||
|
|
|
@ -7,8 +7,8 @@ namespace Friendica\Test;
|
|||
|
||||
use Dice\Dice;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Friendica\Core\Config\PConfiguration;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Core\Config\IPConfiguration;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\Session\ISession;
|
||||
|
@ -47,7 +47,7 @@ class ApiTest extends DatabaseTest
|
|||
/** @var App */
|
||||
protected $app;
|
||||
|
||||
/** @var Configuration */
|
||||
/** @var IConfiguration */
|
||||
protected $config;
|
||||
|
||||
/** @var Dice */
|
||||
|
@ -69,8 +69,8 @@ class ApiTest extends DatabaseTest
|
|||
/** @var Database $dba */
|
||||
$dba = $this->dice->create(Database::class);
|
||||
|
||||
/** @var Configuration $config */
|
||||
$this->config = $this->dice->create(Configuration::class);
|
||||
/** @var IConfiguration $config */
|
||||
$this->config = $this->dice->create(IConfiguration::class);
|
||||
|
||||
$this->config->set('system', 'url', 'http://localhost');
|
||||
$this->config->set('system', 'hostname', 'localhost');
|
||||
|
@ -827,7 +827,7 @@ class ApiTest extends DatabaseTest
|
|||
*/
|
||||
public function testApiGetUserWithFrioSchema()
|
||||
{
|
||||
$pConfig = $this->dice->create(PConfiguration::class);
|
||||
$pConfig = $this->dice->create(IPConfiguration::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(PConfiguration::class);
|
||||
$pConfig = $this->dice->create(IPConfiguration::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(PConfiguration::class);
|
||||
$pConfig = $this->dice->create(IPConfiguration::class);
|
||||
$pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
|
||||
$user = api_get_user($this->app);
|
||||
$this->assertSelfUser($user);
|
||||
|
|
26
tests/phpunit-local.xml
Normal file
26
tests/phpunit-local.xml
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<phpunit
|
||||
bootstrap="bootstrap.php"
|
||||
verbose="true">
|
||||
<testsuite name='friendica'>
|
||||
<directory suffix='.php'>functional/</directory>
|
||||
<directory suffix='.php'>include/</directory>
|
||||
<directory suffix='.php'>src/</directory>
|
||||
<directory suffix='.php'>./</directory>
|
||||
</testsuite>
|
||||
<!-- Filters for Code Coverage -->
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">..</directory>
|
||||
<exclude>
|
||||
<directory suffix=".php">config/</directory>
|
||||
<directory suffix=".php">doc/</directory>
|
||||
<directory suffix=".php">images/</directory>
|
||||
<directory suffix=".php">library/</directory>
|
||||
<directory suffix=".php">spec/</directory>
|
||||
<directory suffix=".php">tests/</directory>
|
||||
<directory suffix=".php">view/</directory>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Test\src\App;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\LegacyModule;
|
||||
use Friendica\Module\HTTPException\PageNotFound;
|
||||
use Friendica\Module\WellKnown\HostMeta;
|
||||
|
@ -149,7 +149,7 @@ class ModuleTest extends DatabaseTest
|
|||
*/
|
||||
public function testModuleClass($assert, string $name, string $command, bool $privAdd)
|
||||
{
|
||||
$config = \Mockery::mock(Configuration::class);
|
||||
$config = \Mockery::mock(IConfiguration::class);
|
||||
$config->shouldReceive('get')->with('config', 'private_addons', false)->andReturn($privAdd)->atMost()->once();
|
||||
|
||||
$router = (new App\Router([]))->loadRoutes(include __DIR__ . '/../../../static/routes.config.php');
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace Friendica\Test\src\Console;
|
|||
use Friendica\App;
|
||||
use Friendica\App\Mode;
|
||||
use Friendica\Console\Config;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Mockery\MockInterface;
|
||||
|
||||
class ConfigConsoleTest extends ConsoleTest
|
||||
|
@ -29,7 +29,7 @@ class ConfigConsoleTest extends ConsoleTest
|
|||
$this->appMode->shouldReceive('has')
|
||||
->andReturn(true);
|
||||
|
||||
$this->configMock = \Mockery::mock(Configuration::class);
|
||||
$this->configMock = \Mockery::mock(IConfiguration::class);
|
||||
}
|
||||
|
||||
function testSetGetKeyValue()
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Test\src\Console;
|
||||
|
||||
use Friendica\Console\ServerBlock;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
|
||||
class ServerBlockConsoleTest extends ConsoleTest
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ class ServerBlockConsoleTest extends ConsoleTest
|
|||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->configMock = \Mockery::mock(Configuration::class);
|
||||
$this->configMock = \Mockery::mock(IConfiguration::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,13 +43,13 @@ class BBCodeTest extends MockedTest
|
|||
$l10nMock = \Mockery::mock(L10n::class);
|
||||
$l10nMock->shouldReceive('t')->withAnyArgs()->andReturnUsing(function ($args) { return $args; });
|
||||
$this->dice->shouldReceive('create')
|
||||
->with(L10n::class)
|
||||
->with(L10n::class, [])
|
||||
->andReturn($l10nMock);
|
||||
|
||||
$baseUrlMock = \Mockery::mock(BaseURL::class);
|
||||
$baseUrlMock->shouldReceive('get')->withAnyArgs()->andReturn('friendica.local');
|
||||
$this->dice->shouldReceive('create')
|
||||
->with(BaseURL::class)
|
||||
->with(BaseURL::class, [])
|
||||
->andReturn($baseUrlMock);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Testsrc\Model\User;
|
||||
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Model\User\Cookie;
|
||||
use Friendica\Test\DatabaseTest;
|
||||
use Friendica\Test\Util\StaticCookie;
|
||||
|
@ -11,7 +11,7 @@ use Mockery\MockInterface;
|
|||
|
||||
class CookieTest extends DatabaseTest
|
||||
{
|
||||
/** @var MockInterface|Configuration */
|
||||
/** @var MockInterface|IConfiguration */
|
||||
private $config;
|
||||
/** @var MockInterface|BaseURL */
|
||||
private $baseUrl;
|
||||
|
@ -22,7 +22,7 @@ class CookieTest extends DatabaseTest
|
|||
|
||||
parent::setUp();
|
||||
|
||||
$this->config = \Mockery::mock(Configuration::class);
|
||||
$this->config = \Mockery::mock(IConfiguration::class);
|
||||
$this->baseUrl = \Mockery::mock(BaseURL::class);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,14 +16,13 @@ class CurlResultTest extends TestCase
|
|||
{
|
||||
parent::setUp();
|
||||
|
||||
|
||||
/** @var Dice|MockInterface $dice */
|
||||
$dice = \Mockery::mock(Dice::class)->makePartial();
|
||||
$dice = $dice->addRules(include __DIR__ . '/../../../static/dependencies.config.php');
|
||||
|
||||
$logger = new NullLogger();
|
||||
$dice->shouldReceive('create')
|
||||
->with(LoggerInterface::class)
|
||||
->with(LoggerInterface::class, [])
|
||||
->andReturn($logger);
|
||||
|
||||
DI::init($dice);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
namespace Friendica\Test\src\Util;
|
||||
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Test\MockedTest;
|
||||
|
||||
class BaseURLTest extends MockedTest
|
||||
|
@ -173,7 +173,7 @@ class BaseURLTest extends MockedTest
|
|||
*/
|
||||
public function testCheck($server, $input, $assert)
|
||||
{
|
||||
$configMock = \Mockery::mock(Configuration::class);
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock->shouldReceive('get')->with('config', 'hostname')->andReturn($input['hostname']);
|
||||
$configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn($input['urlPath']);
|
||||
$configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($input['sslPolicy']);
|
||||
|
@ -295,7 +295,7 @@ class BaseURLTest extends MockedTest
|
|||
*/
|
||||
public function testSave($input, $save, $url)
|
||||
{
|
||||
$configMock = \Mockery::mock(Configuration::class);
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock->shouldReceive('get')->with('config', 'hostname')->andReturn($input['hostname']);
|
||||
$configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn($input['urlPath']);
|
||||
$configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($input['sslPolicy']);
|
||||
|
@ -333,7 +333,7 @@ class BaseURLTest extends MockedTest
|
|||
*/
|
||||
public function testSaveByUrl($input, $save, $url)
|
||||
{
|
||||
$configMock = \Mockery::mock(Configuration::class);
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock->shouldReceive('get')->with('config', 'hostname')->andReturn($input['hostname']);
|
||||
$configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn($input['urlPath']);
|
||||
$configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($input['sslPolicy']);
|
||||
|
@ -409,7 +409,7 @@ class BaseURLTest extends MockedTest
|
|||
*/
|
||||
public function testGetURL($sslPolicy, $ssl, $url, $assert)
|
||||
{
|
||||
$configMock = \Mockery::mock(Configuration::class);
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock->shouldReceive('get')->with('config', 'hostname')->andReturn('friendica.local');
|
||||
$configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn('new/test');
|
||||
$configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($sslPolicy);
|
||||
|
@ -467,7 +467,7 @@ class BaseURLTest extends MockedTest
|
|||
*/
|
||||
public function testCheckRedirectHTTPS($server, $forceSSL, $sslPolicy, $url, $redirect)
|
||||
{
|
||||
$configMock = \Mockery::mock(Configuration::class);
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock->shouldReceive('get')->with('config', 'hostname')->andReturn('friendica.local');
|
||||
$configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn('new/test');
|
||||
$configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($sslPolicy);
|
||||
|
@ -503,7 +503,7 @@ class BaseURLTest extends MockedTest
|
|||
*/
|
||||
public function testWrongSave($fail)
|
||||
{
|
||||
$configMock = \Mockery::mock(Configuration::class);
|
||||
$configMock = \Mockery::mock(IConfiguration::class);
|
||||
$configMock->shouldReceive('get')->with('config', 'hostname')->andReturn('friendica.local');
|
||||
$configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn('new/test');
|
||||
$configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn(BaseURL::DEFAULT_SSL_SCHEME);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace Friendica\Test\src\Util;
|
||||
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
use Friendica\Test\MockedTest;
|
||||
use Friendica\Util\Profiler;
|
||||
use Mockery\MockInterface;
|
||||
|
@ -235,7 +235,7 @@ class ProfilerTest extends MockedTest
|
|||
|
||||
$profiler->saveTimestamp(time(), 'network', 'test1');
|
||||
|
||||
$config = \Mockery::mock(Configuration::class);
|
||||
$config = \Mockery::mock(IConfiguration::class);
|
||||
$config->shouldReceive('get')
|
||||
->with('system', 'profiler')
|
||||
->andReturn(false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue