namespace Friendica\Test\src\Console;
+use Dice\Dice;
+use Friendica\App;
use Friendica\Console\AutomaticInstallation;
-use Friendica\Core\Config\Cache\ConfigCache;
+use Friendica\Core\Config\Cache;
use Friendica\Core\Installer;
-use Friendica\Core\L10n\L10n;
+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\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 VFSTrait;
use DBAMockTrait;
use DBStructureMockTrait;
use RendererMockTrait;
private $assertFileDb;
/**
- * @var ConfigCache The configuration cache to check after each test
+ * @var Cache The configuration cache to check after each test
*/
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();
$l10nMock = \Mockery::mock(L10n::class);
$l10nMock->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
- \Friendica\Core\L10n::init($l10nMock);
- $this->configCache = new ConfigCache();
+ $this->dice->shouldReceive('create')
+ ->with(L10n::class)
+ ->andReturn($l10nMock);
+
+ DI::init($this->dice);
+
+ $this->configCache = new Cache();
$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);
$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);
}