Bugfixing AutomaticInstallation test
This commit is contained in:
parent
bc73d4bd2b
commit
90e88d6c35
|
@ -100,10 +100,10 @@ HELP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$db_host = Config::getConfigValue('database', 'hostname');
|
$db_host = $a->getConfig()->get('database', 'hostname');
|
||||||
$db_user = Config::getConfigValue('database', 'username');
|
$db_user = $a->getConfig()->get('database', 'username');
|
||||||
$db_pass = Config::getConfigValue('database', 'password');
|
$db_pass = $a->getConfig()->get('database', 'password');
|
||||||
$db_data = Config::getConfigValue('database', 'database');
|
$db_data = $a->getConfig()->get('database', 'database');
|
||||||
} else {
|
} else {
|
||||||
// Creating config file
|
// Creating config file
|
||||||
$this->out("Creating config file...\n");
|
$this->out("Creating config file...\n");
|
||||||
|
|
|
@ -124,9 +124,9 @@ HELP;
|
||||||
$cat = $this->getArgument(0);
|
$cat = $this->getArgument(0);
|
||||||
Core\Config::load($cat);
|
Core\Config::load($cat);
|
||||||
|
|
||||||
if (Core\Config::getConfigValue($cat) !== null) {
|
if ($a->getConfig()->get($cat) !== null) {
|
||||||
$this->out("[{$cat}]");
|
$this->out("[{$cat}]");
|
||||||
$catVal = Core\Config::getConfigValue($cat);
|
$catVal = $a->getConfig()->get($cat);
|
||||||
foreach ($catVal as $key => $value) {
|
foreach ($catVal as $key => $value) {
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
foreach ($value as $k => $v) {
|
foreach ($value as $k => $v) {
|
||||||
|
@ -148,7 +148,7 @@ HELP;
|
||||||
$this->out('Warning: The JIT (Just In Time) Config adapter doesn\'t support loading the entire configuration, showing file config only');
|
$this->out('Warning: The JIT (Just In Time) Config adapter doesn\'t support loading the entire configuration, showing file config only');
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = Core\Config::getAll();
|
$config = $a->getConfig()->getAll();
|
||||||
foreach ($config as $cat => $section) {
|
foreach ($config as $cat => $section) {
|
||||||
if (is_array($section)) {
|
if (is_array($section)) {
|
||||||
foreach ($section as $key => $value) {
|
foreach ($section as $key => $value) {
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace Friendica\Core\Console;
|
namespace Friendica\Core\Console;
|
||||||
|
|
||||||
|
use Friendica\BaseObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tired of chasing typos and finding them after a commit.
|
* Tired of chasing typos and finding them after a commit.
|
||||||
* Run this and quickly see if we've got any parse errors in our application files.
|
* Run this and quickly see if we've got any parse errors in our application files.
|
||||||
|
@ -41,7 +43,7 @@ HELP;
|
||||||
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
||||||
}
|
}
|
||||||
|
|
||||||
$php_path = \Friendica\Core\Config::getConfigValue('config', 'php_path', 'php');
|
$php_path = BaseObject::getApp()->getConfig()->get('config', 'php_path', 'php');
|
||||||
|
|
||||||
if ($this->getOption('v')) {
|
if ($this->getOption('v')) {
|
||||||
$this->out('Directory: src');
|
$this->out('Directory: src');
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace Friendica\Test\Util;
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\BaseObject;
|
use Friendica\BaseObject;
|
||||||
|
use Friendica\Core\Config\ConfigCache;
|
||||||
use Friendica\Render\FriendicaSmartyEngine;
|
use Friendica\Render\FriendicaSmartyEngine;
|
||||||
use Mockery\MockInterface;
|
use Mockery\MockInterface;
|
||||||
use org\bovigo\vfs\vfsStreamDirectory;
|
use org\bovigo\vfs\vfsStreamDirectory;
|
||||||
|
@ -24,8 +25,9 @@ trait AppMockTrait
|
||||||
* Mock the App
|
* Mock the App
|
||||||
*
|
*
|
||||||
* @param vfsStreamDirectory $root The root directory
|
* @param vfsStreamDirectory $root The root directory
|
||||||
|
* @param MockInterface|ConfigCache $config The config cache
|
||||||
*/
|
*/
|
||||||
public function mockApp($root)
|
public function mockApp($root, $config)
|
||||||
{
|
{
|
||||||
$this->mockConfigGet('system', 'theme', 'testtheme');
|
$this->mockConfigGet('system', 'theme', 'testtheme');
|
||||||
|
|
||||||
|
@ -35,22 +37,26 @@ trait AppMockTrait
|
||||||
->shouldReceive('getBasePath')
|
->shouldReceive('getBasePath')
|
||||||
->andReturn($root->url());
|
->andReturn($root->url());
|
||||||
|
|
||||||
$this->app
|
$config
|
||||||
->shouldReceive('getConfigValue')
|
->shouldReceive('get')
|
||||||
->with('database', 'hostname')
|
->with('database', 'hostname')
|
||||||
->andReturn(getenv('MYSQL_HOST'));
|
->andReturn(getenv('MYSQL_HOST'));
|
||||||
$this->app
|
$config
|
||||||
->shouldReceive('getConfigValue')
|
->shouldReceive('get')
|
||||||
->with('database', 'username')
|
->with('database', 'username')
|
||||||
->andReturn(getenv('MYSQL_USERNAME'));
|
->andReturn(getenv('MYSQL_USERNAME'));
|
||||||
$this->app
|
$config
|
||||||
->shouldReceive('getConfigValue')
|
->shouldReceive('get')
|
||||||
->with('database', 'password')
|
->with('database', 'password')
|
||||||
->andReturn(getenv('MYSQL_PASSWORD'));
|
->andReturn(getenv('MYSQL_PASSWORD'));
|
||||||
$this->app
|
$config
|
||||||
->shouldReceive('getConfigValue')
|
->shouldReceive('get')
|
||||||
->with('database', 'database')
|
->with('database', 'database')
|
||||||
->andReturn(getenv('MYSQL_DATABASE'));
|
->andReturn(getenv('MYSQL_DATABASE'));
|
||||||
|
$this->app
|
||||||
|
->shouldReceive('getConfig')
|
||||||
|
->andReturn($config);
|
||||||
|
|
||||||
$this->app
|
$this->app
|
||||||
->shouldReceive('getTemplateEngine')
|
->shouldReceive('getTemplateEngine')
|
||||||
->andReturn(new FriendicaSmartyEngine());
|
->andReturn(new FriendicaSmartyEngine());
|
||||||
|
|
|
@ -32,7 +32,8 @@ class BaseObjectTest extends TestCase
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$this->setUpVfsDir();
|
$this->setUpVfsDir();
|
||||||
$this->mockApp($this->root);
|
$configMock = \Mockery::mock('Friendica\Core\Config\ConfigCache');
|
||||||
|
$this->mockApp($this->root, $configMock);
|
||||||
|
|
||||||
$this->baseObject = new BaseObject();
|
$this->baseObject = new BaseObject();
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,8 @@ abstract class CacheTest extends MockedTest
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$this->setUpVfsDir();
|
$this->setUpVfsDir();
|
||||||
$this->mockApp($this->root);
|
$configMock = \Mockery::mock('Friendica\Core\Config\ConfigCache');
|
||||||
|
$this->mockApp($this->root, $configMock);
|
||||||
$this->app
|
$this->app
|
||||||
->shouldReceive('getHostname')
|
->shouldReceive('getHostname')
|
||||||
->andReturn('friendica.local');
|
->andReturn('friendica.local');
|
||||||
|
|
|
@ -181,7 +181,7 @@ FIN;
|
||||||
$this->mockConnect(true, 1);
|
$this->mockConnect(true, 1);
|
||||||
$this->mockConnected(true, 1);
|
$this->mockConnected(true, 1);
|
||||||
$this->mockExistsTable('user', false, 1);
|
$this->mockExistsTable('user', false, 1);
|
||||||
$this->mockUpdate([false, true, true], null, 1);
|
$this->mockUpdate([$this->root->url(), false, true, true], null, 1);
|
||||||
|
|
||||||
$config = <<<CONF
|
$config = <<<CONF
|
||||||
<?php
|
<?php
|
||||||
|
@ -241,7 +241,7 @@ CONF;
|
||||||
$this->mockConnect(true, 1);
|
$this->mockConnect(true, 1);
|
||||||
$this->mockConnected(true, 1);
|
$this->mockConnected(true, 1);
|
||||||
$this->mockExistsTable('user', false, 1);
|
$this->mockExistsTable('user', false, 1);
|
||||||
$this->mockUpdate([false, true, true], null, 1);
|
$this->mockUpdate([$this->root->url(), false, true, true], null, 1);
|
||||||
|
|
||||||
$this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
|
$this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
|
||||||
$this->mockReplaceMacros('testTemplate', $this->createArgumentsForMacro(true), '', 1);
|
$this->mockReplaceMacros('testTemplate', $this->createArgumentsForMacro(true), '', 1);
|
||||||
|
@ -267,7 +267,7 @@ CONF;
|
||||||
$this->mockConnect(true, 1);
|
$this->mockConnect(true, 1);
|
||||||
$this->mockConnected(true, 1);
|
$this->mockConnected(true, 1);
|
||||||
$this->mockExistsTable('user', false, 1);
|
$this->mockExistsTable('user', false, 1);
|
||||||
$this->mockUpdate([false, true, true], null, 1);
|
$this->mockUpdate([$this->root->url(), false, true, true], null, 1);
|
||||||
|
|
||||||
$this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
|
$this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
|
||||||
$this->mockReplaceMacros('testTemplate', $this->createArgumentsForMacro(false), '', 1);
|
$this->mockReplaceMacros('testTemplate', $this->createArgumentsForMacro(false), '', 1);
|
||||||
|
@ -292,7 +292,7 @@ CONF;
|
||||||
$this->mockConnect(true, 1);
|
$this->mockConnect(true, 1);
|
||||||
$this->mockConnected(true, 1);
|
$this->mockConnected(true, 1);
|
||||||
$this->mockExistsTable('user', false, 1);
|
$this->mockExistsTable('user', false, 1);
|
||||||
$this->mockUpdate([false, true, true], null, 1);
|
$this->mockUpdate([$this->root->url(), false, true, true], null, 1);
|
||||||
|
|
||||||
$this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
|
$this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
|
||||||
$this->mockReplaceMacros('testTemplate', $this->createArgumentsForMacro(true), '', 1);
|
$this->mockReplaceMacros('testTemplate', $this->createArgumentsForMacro(true), '', 1);
|
||||||
|
|
|
@ -29,7 +29,8 @@ abstract class ConsoleTest extends MockedTest
|
||||||
Intercept::setUp();
|
Intercept::setUp();
|
||||||
|
|
||||||
$this->setUpVfsDir();
|
$this->setUpVfsDir();
|
||||||
$this->mockApp($this->root);
|
$configMock = \Mockery::mock('Friendica\Core\Config\ConfigCache');
|
||||||
|
$this->mockApp($this->root, $configMock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,7 +31,8 @@ abstract class LockTest extends MockedTest
|
||||||
|
|
||||||
// Reusable App object
|
// Reusable App object
|
||||||
$this->setUpVfsDir();
|
$this->setUpVfsDir();
|
||||||
$this->mockApp($this->root);
|
$configMock = \Mockery::mock('Friendica\Core\Config\ConfigCache');
|
||||||
|
$this->mockApp($this->root, $configMock);
|
||||||
$this->app
|
$this->app
|
||||||
->shouldReceive('getHostname')
|
->shouldReceive('getHostname')
|
||||||
->andReturn('friendica.local');
|
->andReturn('friendica.local');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user