namespace Friendica\Test\src\Console;
+use Dice\Dice;
+use Friendica\App;
use Friendica\Console\AutomaticInstallation;
use Friendica\Core\Config\Cache\ConfigCache;
use Friendica\Core\Installer;
+use Friendica\Core\L10n;
use Friendica\Core\Logger;
+use Friendica\Database\Database;
+use Friendica\DI;
use Friendica\Test\Util\DBAMockTrait;
use Friendica\Test\Util\DBStructureMockTrait;
-use Friendica\Test\Util\L10nMockTrait;
use Friendica\Test\Util\RendererMockTrait;
-use Friendica\Util\BaseURL;
+use Friendica\Test\Util\VFSTrait;
use Friendica\Util\Logger\VoidLogger;
+use Mockery\MockInterface;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamFile;
-/**
- * @requires PHP 7.0
- */
class AutomaticInstallationConsoleTest extends ConsoleTest
{
- use L10nMockTrait;
+ use VFSTrait;
use DBAMockTrait;
use DBStructureMockTrait;
use RendererMockTrait;
*/
private $configCache;
+ /**
+ * @var App\Mode
+ */
+ private $appMode;
+
+ /**
+ * @var Database
+ */
+ private $dba;
+
+ /**
+ * @var Dice|MockInterface
+ */
+ private $dice;
+
public function setUp()
{
$this->markTestSkipped('Needs class \'Installer\' as constructing argument for console tests');
parent::setUp();
+ $this->setUpVfsDir();;
+
if ($this->root->hasChild('config' . DIRECTORY_SEPARATOR . 'local.config.php')) {
$this->root->getChild('config')
->removeChild('local.config.php');
}
+ $this->dice = \Mockery::mock(Dice::class)->makePartial();
- $this->mockL10nT();
+ $l10nMock = \Mockery::mock(L10n::class);
+ $l10nMock->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
+
+ $this->dice->shouldReceive('create')
+ ->with(L10n::class)
+ ->andReturn($l10nMock);
+
+ DI::init($this->dice);
$this->configCache = new ConfigCache();
$this->configCache->set('system', 'basepath', $this->root->url());
$this->configCache->set('config', 'php_path', trim(shell_exec('which php')));
$this->configCache->set('system', 'theme', 'smarty3');
- $this->mockApp($this->root, true);
-
$this->configMock->shouldReceive('set')->andReturnUsing(function ($cat, $key, $value) {
if ($key !== 'basepath') {
return $this->configCache->set($cat, $key, $value);
return $this->configCache->get($cat, $key);
});
$this->configMock->shouldReceive('load')->andReturnUsing(function ($config, $overwrite = false) {
- return $this->configCache->load($config, $overwrite);
+ $this->configCache->load($config, $overwrite);
});
$this->mode->shouldReceive('isInstall')->andReturn(true);
$this->assertConfigEntry('system', 'language', $assertion, ($default) ? Installer::DEFAULT_LANG : null);
$this->assertConfigEntry('system', 'url', $assertion);
$this->assertConfigEntry('system', 'urlpath', $assertion);
- $this->assertConfigEntry('system', 'ssl_policy', $assertion, ($default) ? BaseURL::DEFAULT_SSL_SCHEME : null);
+ $this->assertConfigEntry('system', 'ssl_policy', $assertion, ($default) ? App\BaseURL::DEFAULT_SSL_SCHEME : null);
$this->assertConfigEntry('system', 'basepath', ($realBasepath) ? $this->root->url() : $assertion);
}