Improve & fixing Tests
This commit is contained in:
parent
486f139342
commit
c293eadb78
7 changed files with 76 additions and 63 deletions
|
@ -252,6 +252,20 @@ abstract class ConfigurationTest extends MockedTest
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the configuration load without result
|
||||
*/
|
||||
public function testLoadWrong()
|
||||
{
|
||||
$this->configModel->shouldReceive('isConnected')->andReturn(true)->once();
|
||||
$this->configModel->shouldReceive('load')->withAnyArgs()->andReturn([])->once();
|
||||
|
||||
$this->testedConfig = $this->getInstance();
|
||||
$this->assertInstanceOf(ConfigCache::class, $this->testedConfig->getCache());
|
||||
|
||||
$this->assertEmpty($this->testedConfig->getCache()->getAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the configuration get() and set() methods without adapter
|
||||
*
|
||||
|
|
|
@ -6,26 +6,19 @@ use Friendica\Core\Config;
|
|||
use Friendica\Database\DBA;
|
||||
use Friendica\Factory;
|
||||
use Friendica\Test\DatabaseTest;
|
||||
use Friendica\Util\BasePath;
|
||||
use Friendica\Util\BaseURL;
|
||||
use Friendica\Util\Config\ConfigFileLoader;
|
||||
|
||||
class DBATest extends DatabaseTest
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
$basePath = BasePath::create(dirname(__DIR__) . '/../../');
|
||||
$mode = new App\Mode($basePath);
|
||||
$router = new App\Router();
|
||||
$configLoader = new ConfigFileLoader($basePath, $mode);
|
||||
$configCache = Factory\ConfigFactory::createCache($configLoader);
|
||||
$profiler = Factory\ProfilerFactory::create($configCache);
|
||||
$database = Factory\DBFactory::init($configCache, $profiler, $_SERVER);
|
||||
$config = Factory\ConfigFactory::createConfig($configCache);
|
||||
Factory\ConfigFactory::createPConfig($configCache, new Config\Cache\PConfigCache());
|
||||
$logger = Factory\LoggerFactory::create('test', $database, $config, $profiler);
|
||||
$configModel = new \Friendica\Model\Config\Config(self::$dba);
|
||||
$config = Factory\ConfigFactory::createConfig(self::$configCache, $configModel);
|
||||
Factory\ConfigFactory::createPConfig(new Config\Cache\PConfigCache());
|
||||
$logger = Factory\LoggerFactory::create('test', self::$dba, $config, self::$profiler);
|
||||
$baseUrl = new BaseURL($config, $_SERVER);
|
||||
$this->app = new App($database, $config, $mode, $router, $baseUrl, $logger, $profiler, false);
|
||||
$router = new App\Router();
|
||||
$this->app = new App(self::$dba, $config, self::$mode, $router, $baseUrl, $logger, self::$profiler, false);
|
||||
|
||||
parent::setUp();
|
||||
|
||||
|
|
|
@ -7,26 +7,19 @@ use Friendica\Core\Config\Cache\PConfigCache;
|
|||
use Friendica\Database\DBStructure;
|
||||
use Friendica\Factory;
|
||||
use Friendica\Test\DatabaseTest;
|
||||
use Friendica\Util\BasePath;
|
||||
use Friendica\Util\BaseURL;
|
||||
use Friendica\Util\Config\ConfigFileLoader;
|
||||
|
||||
class DBStructureTest extends DatabaseTest
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
$basePath = BasePath::create(dirname(__DIR__) . '/../../');
|
||||
$mode = new App\Mode($basePath);
|
||||
$router = new App\Router();
|
||||
$configLoader = new ConfigFileLoader($basePath, $mode);
|
||||
$configCache = Factory\ConfigFactory::createCache($configLoader);
|
||||
$profiler = Factory\ProfilerFactory::create($configCache);
|
||||
$database = Factory\DBFactory::init($configCache, $profiler, $_SERVER);
|
||||
$config = Factory\ConfigFactory::createConfig($configCache);
|
||||
Factory\ConfigFactory::createPConfig($configCache, new PConfigCache());
|
||||
$logger = Factory\LoggerFactory::create('test', $database, $config, $profiler);
|
||||
$configModel = new \Friendica\Model\Config\Config(self::$dba);
|
||||
$config = Factory\ConfigFactory::createConfig(self::$configCache, $configModel);
|
||||
Factory\ConfigFactory::createPConfig(new PConfigCache());
|
||||
$logger = Factory\LoggerFactory::create('test', self::$dba, $config, self::$profiler);
|
||||
$baseUrl = new BaseURL($config, $_SERVER);
|
||||
$this->app = new App($database, $config, $mode, $router, $baseUrl, $logger, $profiler, false);
|
||||
$router = new App\Router();
|
||||
$this->app = new App(self::$dba, $config, self::$mode, $router, $baseUrl, $logger, self::$profiler, false);
|
||||
|
||||
parent::setUp();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue