Bugfixing AutomaticInstallation test
This commit is contained in:
parent
bc73d4bd2b
commit
90e88d6c35
9 changed files with 37 additions and 25 deletions
|
@ -4,6 +4,7 @@ namespace Friendica\Test\Util;
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Core\Config\ConfigCache;
|
||||
use Friendica\Render\FriendicaSmartyEngine;
|
||||
use Mockery\MockInterface;
|
||||
use org\bovigo\vfs\vfsStreamDirectory;
|
||||
|
@ -24,8 +25,9 @@ trait AppMockTrait
|
|||
* Mock the App
|
||||
*
|
||||
* @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');
|
||||
|
||||
|
@ -35,22 +37,26 @@ trait AppMockTrait
|
|||
->shouldReceive('getBasePath')
|
||||
->andReturn($root->url());
|
||||
|
||||
$this->app
|
||||
->shouldReceive('getConfigValue')
|
||||
$config
|
||||
->shouldReceive('get')
|
||||
->with('database', 'hostname')
|
||||
->andReturn(getenv('MYSQL_HOST'));
|
||||
$this->app
|
||||
->shouldReceive('getConfigValue')
|
||||
$config
|
||||
->shouldReceive('get')
|
||||
->with('database', 'username')
|
||||
->andReturn(getenv('MYSQL_USERNAME'));
|
||||
$this->app
|
||||
->shouldReceive('getConfigValue')
|
||||
$config
|
||||
->shouldReceive('get')
|
||||
->with('database', 'password')
|
||||
->andReturn(getenv('MYSQL_PASSWORD'));
|
||||
$this->app
|
||||
->shouldReceive('getConfigValue')
|
||||
$config
|
||||
->shouldReceive('get')
|
||||
->with('database', 'database')
|
||||
->andReturn(getenv('MYSQL_DATABASE'));
|
||||
$this->app
|
||||
->shouldReceive('getConfig')
|
||||
->andReturn($config);
|
||||
|
||||
$this->app
|
||||
->shouldReceive('getTemplateEngine')
|
||||
->andReturn(new FriendicaSmartyEngine());
|
||||
|
|
|
@ -32,7 +32,8 @@ class BaseObjectTest extends TestCase
|
|||
protected function setUp()
|
||||
{
|
||||
$this->setUpVfsDir();
|
||||
$this->mockApp($this->root);
|
||||
$configMock = \Mockery::mock('Friendica\Core\Config\ConfigCache');
|
||||
$this->mockApp($this->root, $configMock);
|
||||
|
||||
$this->baseObject = new BaseObject();
|
||||
}
|
||||
|
|
|
@ -69,7 +69,8 @@ abstract class CacheTest extends MockedTest
|
|||
protected function setUp()
|
||||
{
|
||||
$this->setUpVfsDir();
|
||||
$this->mockApp($this->root);
|
||||
$configMock = \Mockery::mock('Friendica\Core\Config\ConfigCache');
|
||||
$this->mockApp($this->root, $configMock);
|
||||
$this->app
|
||||
->shouldReceive('getHostname')
|
||||
->andReturn('friendica.local');
|
||||
|
|
|
@ -181,7 +181,7 @@ FIN;
|
|||
$this->mockConnect(true, 1);
|
||||
$this->mockConnected(true, 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
|
||||
<?php
|
||||
|
@ -241,7 +241,7 @@ CONF;
|
|||
$this->mockConnect(true, 1);
|
||||
$this->mockConnected(true, 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->mockReplaceMacros('testTemplate', $this->createArgumentsForMacro(true), '', 1);
|
||||
|
@ -267,7 +267,7 @@ CONF;
|
|||
$this->mockConnect(true, 1);
|
||||
$this->mockConnected(true, 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->mockReplaceMacros('testTemplate', $this->createArgumentsForMacro(false), '', 1);
|
||||
|
@ -292,7 +292,7 @@ CONF;
|
|||
$this->mockConnect(true, 1);
|
||||
$this->mockConnected(true, 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->mockReplaceMacros('testTemplate', $this->createArgumentsForMacro(true), '', 1);
|
||||
|
|
|
@ -29,7 +29,8 @@ abstract class ConsoleTest extends MockedTest
|
|||
Intercept::setUp();
|
||||
|
||||
$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
|
||||
$this->setUpVfsDir();
|
||||
$this->mockApp($this->root);
|
||||
$configMock = \Mockery::mock('Friendica\Core\Config\ConfigCache');
|
||||
$this->mockApp($this->root, $configMock);
|
||||
$this->app
|
||||
->shouldReceive('getHostname')
|
||||
->andReturn('friendica.local');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue