]> git.mxchange.org Git - friendica.git/blobdiff - tests/src/Console/AutomaticInstallationConsoleTest.php
Merge pull request #12231 from HankG/fix-unfavourite-endpoint
[friendica.git] / tests / src / Console / AutomaticInstallationConsoleTest.php
index b0481be98c84af17d55012cf693d712e82e33d25..a76ae1c06313e1d62f4b9da6b262deac157f0713 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -24,26 +24,23 @@ namespace Friendica\Test\src\Console;
 use Dice\Dice;
 use Friendica\App;
 use Friendica\Console\AutomaticInstallation;
-use Friendica\Core\Config\Cache;
+use Friendica\Core\Config\ValueObject\Cache;
 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\RendererMockTrait;
 use Friendica\Test\Util\VFSTrait;
-use Friendica\Util\Logger\VoidLogger;
+use Mockery;
 use Mockery\MockInterface;
 use org\bovigo\vfs\vfsStream;
 use org\bovigo\vfs\vfsStreamFile;
+use Psr\Log\NullLogger;
 
 class AutomaticInstallationConsoleTest extends ConsoleTest
 {
        use VFSTrait;
-       use DBAMockTrait;
-       use DBStructureMockTrait;
        use RendererMockTrait;
 
        /**
@@ -56,7 +53,7 @@ class AutomaticInstallationConsoleTest extends ConsoleTest
        private $assertFileDb;
 
        /**
-        * @var Cache The configuration cache to check after each test
+        * @var \Friendica\Core\Config\ValueObject\Cache The configuration cache to check after each test
         */
        private $configCache;
 
@@ -75,9 +72,9 @@ class AutomaticInstallationConsoleTest extends ConsoleTest
         */
        private $dice;
 
-       public function setUp()
+       public function setUp() : void
        {
-               $this->markTestSkipped('Needs class \'Installer\' as constructing argument for console tests');
+               static::markTestSkipped('Needs class \'Installer\' as constructing argument for console tests');
 
                parent::setUp();
 
@@ -87,9 +84,9 @@ class AutomaticInstallationConsoleTest extends ConsoleTest
                        $this->root->getChild('config')
                                ->removeChild('local.config.php');
                }
-               $this->dice = \Mockery::mock(Dice::class)->makePartial();
+               $this->dice = Mockery::mock(Dice::class)->makePartial();
 
-               $l10nMock = \Mockery::mock(L10n::class);
+               $l10nMock = Mockery::mock(L10n::class);
                $l10nMock->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
 
                $this->dice->shouldReceive('create')
@@ -120,7 +117,7 @@ class AutomaticInstallationConsoleTest extends ConsoleTest
                });
 
                $this->mode->shouldReceive('isInstall')->andReturn(true);
-               Logger::init(new VoidLogger());
+               Logger::init(new NullLogger());
        }
 
        /**
@@ -400,7 +397,7 @@ FIN;
                $this->mockUpdate([$this->root->url(), false, true, true], null, 1);
 
                $this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
-               $this->mockReplaceMacros('testTemplate', \Mockery::any(), '', 1);
+               $this->mockReplaceMacros('testTemplate', Mockery::any(), '', 1);
 
                $console = new AutomaticInstallation($this->consoleArgv);
                $console->setOption('url', 'http://friendica.local');
@@ -446,6 +443,7 @@ return [
                'password' => '{$conf('database', 'password')}',
                'database' => '{$conf('database', 'database')}',
                'charset' => 'utf8mb4',
+               'pdo_emulate_prepares' => false,
        ],
 
        // ****************************************************************
@@ -502,7 +500,7 @@ CONF;
                $this->mockUpdate([$this->root->url(), false, true, true], null, 1);
 
                $this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
-               $this->mockReplaceMacros('testTemplate', \Mockery::any(), '', 1);
+               $this->mockReplaceMacros('testTemplate', Mockery::any(), '', 1);
 
                self::assertTrue(putenv('MYSQL_HOST='     . $data['database']['hostname']));
                self::assertTrue(putenv('MYSQL_PORT='     . $data['database']['port']));
@@ -540,7 +538,7 @@ CONF;
                $this->mockUpdate([$this->root->url(), false, true, true], null, 1);
 
                $this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
-               $this->mockReplaceMacros('testTemplate', \Mockery::any(), '', 1);
+               $this->mockReplaceMacros('testTemplate', Mockery::any(), '', 1);
 
                self::assertTrue(putenv('MYSQL_HOST=' . $data['database']['hostname']));
                self::assertTrue(putenv('MYSQL_PORT=' . $data['database']['port']));
@@ -576,7 +574,7 @@ CONF;
                $this->mockUpdate([$this->root->url(), false, true, true], null, 1);
 
                $this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
-               $this->mockReplaceMacros('testTemplate', \Mockery::any(), '', 1);
+               $this->mockReplaceMacros('testTemplate', Mockery::any(), '', 1);
 
                $console = new AutomaticInstallation($this->consoleArgv);
 
@@ -611,7 +609,7 @@ CONF;
                $this->mockConnect(false, 1);
 
                $this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
-               $this->mockReplaceMacros('testTemplate', \Mockery::any(), '', 1);
+               $this->mockReplaceMacros('testTemplate', Mockery::any(), '', 1);
 
                $console = new AutomaticInstallation($this->consoleArgv);
                $console->setOption('url', 'http://friendica.local');