]> git.mxchange.org Git - friendica.git/blob - tests/src/Console/AutomaticInstallationConsoleTest.php
Merge pull request #11250 from nupplaphil/bug/redis_pw
[friendica.git] / tests / src / Console / AutomaticInstallationConsoleTest.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2010-2022, the Friendica project
4  *
5  * @license GNU AGPL version 3 or any later version
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Affero General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  *
20  */
21
22 namespace Friendica\Test\src\Console;
23
24 use Dice\Dice;
25 use Friendica\App;
26 use Friendica\Console\AutomaticInstallation;
27 use Friendica\Core\Config\ValueObject\Cache;
28 use Friendica\Core\Installer;
29 use Friendica\Core\L10n;
30 use Friendica\Core\Logger;
31 use Friendica\Database\Database;
32 use Friendica\DI;
33 use Friendica\Test\Util\RendererMockTrait;
34 use Friendica\Test\Util\VFSTrait;
35 use Mockery;
36 use Mockery\MockInterface;
37 use org\bovigo\vfs\vfsStream;
38 use org\bovigo\vfs\vfsStreamFile;
39 use Psr\Log\NullLogger;
40
41 class AutomaticInstallationConsoleTest extends ConsoleTest
42 {
43         use VFSTrait;
44         use RendererMockTrait;
45
46         /**
47          * @var vfsStreamFile Assert file without DB credentials
48          */
49         private $assertFile;
50         /**
51          * @var vfsStreamFile Assert file with DB credentials
52          */
53         private $assertFileDb;
54
55         /**
56          * @var \Friendica\Core\Config\ValueObject\Cache The configuration cache to check after each test
57          */
58         private $configCache;
59
60         /**
61          * @var App\Mode
62          */
63         private $appMode;
64
65         /**
66          * @var Database
67          */
68         private $dba;
69
70         /**
71          * @var Dice|MockInterface
72          */
73         private $dice;
74
75         public function setUp() : void
76         {
77                 static::markTestSkipped('Needs class \'Installer\' as constructing argument for console tests');
78
79                 parent::setUp();
80
81                 $this->setUpVfsDir();;
82
83                 if ($this->root->hasChild('config' . DIRECTORY_SEPARATOR . 'local.config.php')) {
84                         $this->root->getChild('config')
85                                 ->removeChild('local.config.php');
86                 }
87                 $this->dice = Mockery::mock(Dice::class)->makePartial();
88
89                 $l10nMock = Mockery::mock(L10n::class);
90                 $l10nMock->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
91
92                 $this->dice->shouldReceive('create')
93                            ->with(L10n::class)
94                            ->andReturn($l10nMock);
95
96                 DI::init($this->dice);
97
98                 $this->configCache = new Cache();
99                 $this->configCache->set('system', 'basepath', $this->root->url());
100                 $this->configCache->set('config', 'php_path', trim(shell_exec('which php')));
101                 $this->configCache->set('system', 'theme', 'smarty3');
102
103                 $this->configMock->shouldReceive('set')->andReturnUsing(function ($cat, $key, $value) {
104                         if ($key !== 'basepath') {
105                                 return $this->configCache->set($cat, $key, $value);
106                         } else {
107                                 return true;
108                         }
109                 });
110
111                 $this->configMock->shouldReceive('has')->andReturn(true);
112                 $this->configMock->shouldReceive('get')->andReturnUsing(function ($cat, $key) {
113                         return $this->configCache->get($cat, $key);
114                 });
115                 $this->configMock->shouldReceive('load')->andReturnUsing(function ($config, $overwrite = false) {
116                         $this->configCache->load($config, $overwrite);
117                 });
118
119                 $this->mode->shouldReceive('isInstall')->andReturn(true);
120                 Logger::init(new NullLogger());
121         }
122
123         /**
124          * Returns the dataset for each automatic installation test
125          *
126          * @return array the dataset
127          */
128         public function dataInstaller()
129         {
130                 return [
131                         'empty' => [
132                                 'data' => [
133                                         'database' => [
134                                                 'hostname'    => '',
135                                                 'username'    => '',
136                                                 'password'    => '',
137                                                 'database'    => '',
138                                                 'port'        => '',
139                                         ],
140                                         'config' => [
141                                                 'php_path'    => '',
142                                                 'hostname'    => 'friendica.local',
143                                                 'admin_email' => '',
144                                         ],
145                                         'system' => [
146                                                 'basepath'    => '',
147                                                 'urlpath'     => '',
148                                                 'url'         => 'http://friendica.local',
149                                                 'ssl_policy'  => 0,
150                                                 'default_timezone' => '',
151                                                 'language'    => '',
152                                         ],
153                                 ],
154                         ],
155                         'normal' => [
156                                 'data' => [
157                                         'database' => [
158                                                 'hostname'    => 'testhost',
159                                                 'port'        => 3306,
160                                                 'username'    => 'friendica',
161                                                 'password'    => 'a password',
162                                                 'database'    => 'database',
163                                         ],
164                                         'config' => [
165                                                 'php_path'    => '',
166                                                 'hostname'    => 'friendica.local',
167                                                 'admin_email' => 'admin@philipp.info',
168                                         ],
169                                         'system' => [
170                                                 'urlpath'     => 'test/it',
171                                                 'url'         => 'http://friendica.local/test/it',
172                                                 'basepath'    => '',
173                                                 'ssl_policy'  => '2',
174                                                 'default_timezone' => 'en',
175                                                 'language'    => 'Europe/Berlin',
176                                         ],
177                                 ],
178                         ],
179                         'special' => [
180                                 'data' => [
181                                         'database' => [
182                                                 'hostname'    => 'testhost.new.domain',
183                                                 'port'        => 3341,
184                                                 'username'    => 'fr"§%ica',
185                                                 'password'    => '$%\"gse',
186                                                 'database'    => 'db',
187                                         ],
188                                         'config' => [
189                                                 'php_path'    => '',
190                                                 'hostname'    => 'friendica.local',
191                                                 'admin_email' => 'admin@philipp.info',
192                                         ],
193                                         'system' => [
194                                                 'urlpath'     => 'test/it',
195                                                 'url'         => 'https://friendica.local/test/it',
196                                                 'basepath'    => '',
197                                                 'ssl_policy'  => '1',
198                                                 'default_timezone' => 'en',
199                                                 'language'    => 'Europe/Berlin',
200                                         ],
201                                 ],
202                         ],
203                 ];
204         }
205
206         private function assertFinished($txt, $withconfig = false, $copyfile = false)
207         {
208                 $cfg = '';
209
210                 if ($withconfig) {
211                         $cfg = <<<CFG
212
213
214 Creating config file...
215
216  Complete!
217 CFG;
218                 }
219
220                 if ($copyfile) {
221                         $cfg = <<<CFG
222
223
224 Copying config file...
225
226  Complete!
227 CFG;
228                 }
229
230                 $finished = <<<FIN
231 Initializing setup...
232
233  Complete!
234
235
236 Checking environment...
237
238  NOTICE: Not checking .htaccess/URL-Rewrite during CLI installation.
239
240  Complete!
241 {$cfg}
242
243
244 Checking database...
245
246  Complete!
247
248
249 Inserting data into database...
250
251  Complete!
252
253
254 Installing theme
255
256  Complete
257
258
259
260 Installation is finished
261
262
263 FIN;
264                 self::assertEquals($finished, $txt);
265         }
266
267         private function assertStuckDB($txt)
268         {
269                 $finished = <<<FIN
270 Initializing setup...
271
272  Complete!
273
274
275 Checking environment...
276
277  NOTICE: Not checking .htaccess/URL-Rewrite during CLI installation.
278
279  Complete!
280
281
282 Creating config file...
283
284  Complete!
285
286
287 Checking database...
288
289 [Error] --------
290 Could not connect to database.: 
291
292
293 FIN;
294
295                 self::assertEquals($finished, $txt);
296         }
297
298         private function assertStuckURL($txt)
299         {
300                 $finished = <<<FIN
301 Initializing setup...
302
303  Complete!
304
305
306 Checking environment...
307
308  NOTICE: Not checking .htaccess/URL-Rewrite during CLI installation.
309
310  Complete!
311
312
313 Creating config file...
314
315 The Friendica URL has to be set during CLI installation.
316
317 FIN;
318
319                 self::assertEquals($finished, $txt);
320         }
321
322         /**
323          * Asserts one config entry
324          *
325          * @param string     $cat           The category to test
326          * @param string     $key           The key to test
327          * @param null|array $assertion     The asserted value (null = empty, or array/string)
328          * @param string     $default_value The default value
329          */
330         public function assertConfigEntry($cat, $key, $assertion = null, $default_value = null)
331         {
332                 if (!empty($assertion[$cat][$key])) {
333                         self::assertEquals($assertion[$cat][$key], $this->configCache->get($cat, $key));
334                 } elseif (!empty($assertion) && !is_array($assertion)) {
335                         self::assertEquals($assertion, $this->configCache->get($cat, $key));
336                 } elseif (!empty($default_value)) {
337                         self::assertEquals($default_value, $this->configCache->get($cat, $key));
338                 } else {
339                         self::assertEmpty($this->configCache->get($cat, $key), $this->configCache->get($cat, $key));
340                 }
341         }
342
343         /**
344          * Asserts all config entries
345          *
346          * @param null|array $assertion    The optional assertion array
347          * @param boolean    $saveDb       True, if the db credentials should get saved to the file
348          * @param boolean    $default      True, if we use the default values
349          * @param boolean    $defaultDb    True, if we use the default value for the DB
350          * @param boolean    $realBasepath True, if we use the real basepath of the installation, not the mocked one
351          */
352         public function assertConfig($assertion = null, $saveDb = false, $default = true, $defaultDb = true, $realBasepath = false)
353         {
354                 if (!empty($assertion['database']['hostname'])) {
355                         $assertion['database']['hostname'] .= (!empty($assertion['database']['port']) ? ':' . $assertion['database']['port'] : '');
356                 }
357
358                 self::assertConfigEntry('database', 'hostname', ($saveDb) ? $assertion : null, (!$saveDb || $defaultDb) ? Installer::DEFAULT_HOST : null);
359                 self::assertConfigEntry('database', 'username', ($saveDb) ? $assertion : null);
360                 self::assertConfigEntry('database', 'password', ($saveDb) ? $assertion : null);
361                 self::assertConfigEntry('database', 'database', ($saveDb) ? $assertion : null);
362
363                 self::assertConfigEntry('config', 'admin_email', $assertion);
364                 self::assertConfigEntry('config', 'php_path', trim(shell_exec('which php')));
365                 self::assertConfigEntry('config', 'hostname', $assertion);
366
367                 self::assertConfigEntry('system', 'default_timezone', $assertion, ($default) ? Installer::DEFAULT_TZ : null);
368                 self::assertConfigEntry('system', 'language', $assertion, ($default) ? Installer::DEFAULT_LANG : null);
369                 self::assertConfigEntry('system', 'url', $assertion);
370                 self::assertConfigEntry('system', 'urlpath', $assertion);
371                 self::assertConfigEntry('system', 'ssl_policy', $assertion, ($default) ? App\BaseURL::DEFAULT_SSL_SCHEME : null);
372                 self::assertConfigEntry('system', 'basepath', ($realBasepath) ? $this->root->url() : $assertion);
373         }
374
375         /**
376          * Test the automatic installation without any parameter/setting
377          * Should stuck because of missing hostname
378          */
379         public function testEmpty()
380         {
381                 $console = new AutomaticInstallation($this->consoleArgv);
382
383                 $txt = $this->dumpExecute($console);
384
385                 self::assertStuckURL($txt);
386         }
387
388         /**
389          * Test the automatic installation without any parameter/setting
390          * except URL
391          */
392         public function testEmptyWithURL()
393         {
394                 $this->mockConnect(true, 1);
395                 $this->mockConnected(true, 1);
396                 $this->mockExistsTable('user', false, 1);
397                 $this->mockUpdate([$this->root->url(), false, true, true], null, 1);
398
399                 $this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
400                 $this->mockReplaceMacros('testTemplate', Mockery::any(), '', 1);
401
402                 $console = new AutomaticInstallation($this->consoleArgv);
403                 $console->setOption('url', 'http://friendica.local');
404
405                 $txt = $this->dumpExecute($console);
406
407                 self::assertFinished($txt, true, false);
408                 self::assertTrue($this->root->hasChild('config' . DIRECTORY_SEPARATOR . 'local.config.php'));
409
410                 self::assertConfig(['config' => ['hostname' => 'friendica.local'], 'system' => ['url' => 'http://friendica.local', 'ssl_policy' => 0, 'urlPath' => '']], false, true, true, true);
411         }
412
413         /**
414          * Test the automatic installation with a prepared config file
415          * @dataProvider dataInstaller
416          */
417         public function testWithConfig(array $data)
418         {
419                 $this->mockConnect(true, 1);
420                 $this->mockConnected(true, 1);
421                 $this->mockExistsTable('user', false, 1);
422                 $this->mockUpdate([$this->root->url(), false, true, true], null, 1);
423
424                 $conf = function ($cat, $key) use ($data) {
425                         if ($cat == 'database' && $key == 'hostname' && !empty($data['database']['port'])) {
426                                 return $data[$cat][$key] . ':' . $data['database']['port'];
427                         }
428                         return $data[$cat][$key];
429                 };
430
431                 $config = <<<CONF
432 <?php
433
434 // Local configuration
435
436 // If you're unsure about what any of the config keys below do, please check the static/defaults.config.php for detailed
437 // documentation of their data type and behavior.
438
439 return [
440         'database' => [
441                 'hostname' => '{$conf('database', 'hostname')}',
442                 'username' => '{$conf('database', 'username')}',
443                 'password' => '{$conf('database', 'password')}',
444                 'database' => '{$conf('database', 'database')}',
445                 'charset' => 'utf8mb4',
446                 'pdo_emulate_prepares' => false,
447         ],
448
449         // ****************************************************************
450         // The configuration below will be overruled by the admin panel.
451         // Changes made below will only have an effect if the database does
452         // not contain any configuration for the friendica system.
453         // ****************************************************************
454
455         'config' => [
456                 'admin_email' => '{$conf('config', 'admin_email')}',
457                 'hostname' => '{$conf('config', 'hostname')}',
458                 'sitename' => 'Friendica Social Network',
459                 'register_policy' => \Friendica\Module\Register::OPEN,
460                 'register_text' => '',
461         ],
462         'system' => [
463                 'basepath' => '{$conf('system', 'basepath')}',
464                 'urlpath' => '{$conf('system', 'urlpath')}',
465                 'url' => '{$conf('system', 'url')}',
466                 'ssl_policy' => '{$conf('system', 'ssl_policy')}',
467                 'default_timezone' => '{$conf('system', 'default_timezone')}',
468                 'language' => '{$conf('system', 'language')}',
469         ],
470 ];
471 CONF;
472
473                 vfsStream::newFile('prepared.config.php')
474                         ->at($this->root)
475                         ->setContent($config);
476
477                 $console = new AutomaticInstallation($this->consoleArgv);
478                 $console->setOption('f', 'prepared.config.php');
479
480                 $txt = $this->dumpExecute($console);
481
482                 self::assertFinished($txt, false, true);
483
484                 self::assertTrue($this->root->hasChild('config' . DIRECTORY_SEPARATOR . 'local.config.php'));
485                 self::assertEquals($config, file_get_contents($this->root->getChild('config' . DIRECTORY_SEPARATOR . 'local.config.php')->url()));
486
487                 self::assertConfig($data, true, false, false);
488         }
489
490         /**
491          * Test the automatic installation with environment variables
492          * Includes saving the DB credentials to the file
493          * @dataProvider dataInstaller
494          */
495         public function testWithEnvironmentAndSave(array $data)
496         {
497                 $this->mockConnect(true, 1);
498                 $this->mockConnected(true, 1);
499                 $this->mockExistsTable('user', false, 1);
500                 $this->mockUpdate([$this->root->url(), false, true, true], null, 1);
501
502                 $this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
503                 $this->mockReplaceMacros('testTemplate', Mockery::any(), '', 1);
504
505                 self::assertTrue(putenv('MYSQL_HOST='     . $data['database']['hostname']));
506                 self::assertTrue(putenv('MYSQL_PORT='     . $data['database']['port']));
507                 self::assertTrue(putenv('MYSQL_DATABASE=' . $data['database']['database']));
508                 self::assertTrue(putenv('MYSQL_USERNAME=' . $data['database']['username']));
509                 self::assertTrue(putenv('MYSQL_PASSWORD=' . $data['database']['password']));
510
511                 self::assertTrue(putenv('FRIENDICA_HOSTNAME='   . $data['config']['hostname']));
512                 self::assertTrue(putenv('FRIENDICA_BASE_PATH='  . $data['system']['basepath']));
513                 self::assertTrue(putenv('FRIENDICA_URL='        . $data['system']['url']));
514                 self::assertTrue(putenv('FRIENDICA_PHP_PATH='   . $data['config']['php_path']));
515                 self::assertTrue(putenv('FRIENDICA_ADMIN_MAIL=' . $data['config']['admin_email']));
516                 self::assertTrue(putenv('FRIENDICA_TZ='         . $data['system']['default_timezone']));
517                 self::assertTrue(putenv('FRIENDICA_LANG='       . $data['system']['language']));
518
519                 $console = new AutomaticInstallation($this->consoleArgv);
520                 $console->setOption('savedb', true);
521
522                 $txt = $this->dumpExecute($console);
523
524                 self::assertFinished($txt, true);
525                 self::assertConfig($data, true, true, false, true);
526         }
527
528         /**
529          * Test the automatic installation with environment variables
530          * Don't save the db credentials to the file
531          * @dataProvider dataInstaller
532          */
533         public function testWithEnvironmentWithoutSave(array $data)
534         {
535                 $this->mockConnect(true, 1);
536                 $this->mockConnected(true, 1);
537                 $this->mockExistsTable('user', false, 1);
538                 $this->mockUpdate([$this->root->url(), false, true, true], null, 1);
539
540                 $this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
541                 $this->mockReplaceMacros('testTemplate', Mockery::any(), '', 1);
542
543                 self::assertTrue(putenv('MYSQL_HOST=' . $data['database']['hostname']));
544                 self::assertTrue(putenv('MYSQL_PORT=' . $data['database']['port']));
545                 self::assertTrue(putenv('MYSQL_DATABASE=' . $data['database']['database']));
546                 self::assertTrue(putenv('MYSQL_USERNAME=' . $data['database']['username']));
547                 self::assertTrue(putenv('MYSQL_PASSWORD=' . $data['database']['password']));
548
549                 self::assertTrue(putenv('FRIENDICA_HOSTNAME='   . $data['config']['hostname']));
550                 self::assertTrue(putenv('FRIENDICA_BASE_PATH='  . $data['system']['basepath']));
551                 self::assertTrue(putenv('FRIENDICA_URL='        . $data['system']['url']));
552                 self::assertTrue(putenv('FRIENDICA_PHP_PATH='   . $data['config']['php_path']));
553                 self::assertTrue(putenv('FRIENDICA_ADMIN_MAIL=' . $data['config']['admin_email']));
554                 self::assertTrue(putenv('FRIENDICA_TZ='         . $data['system']['default_timezone']));
555                 self::assertTrue(putenv('FRIENDICA_LANG='       . $data['system']['language']));
556
557                 $console = new AutomaticInstallation($this->consoleArgv);
558
559                 $txt = $this->dumpExecute($console);
560
561                 self::assertFinished($txt, true);
562                 self::assertConfig($data, false, true, false, true);
563         }
564
565         /**
566          * Test the automatic installation with arguments
567          * @dataProvider dataInstaller
568          */
569         public function testWithArguments(array $data)
570         {
571                 $this->mockConnect(true, 1);
572                 $this->mockConnected(true, 1);
573                 $this->mockExistsTable('user', false, 1);
574                 $this->mockUpdate([$this->root->url(), false, true, true], null, 1);
575
576                 $this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
577                 $this->mockReplaceMacros('testTemplate', Mockery::any(), '', 1);
578
579                 $console = new AutomaticInstallation($this->consoleArgv);
580
581                 $option = function($var, $cat, $key) use ($data, $console) {
582                         if (!empty($data[$cat][$key])) {
583                                 $console->setOption($var, $data[$cat][$key]);
584                         }
585                 };
586                 $option('dbhost'    , 'database', 'hostname');
587                 $option('dbport'    , 'database', 'port');
588                 $option('dbuser'    , 'database', 'username');
589                 $option('dbpass'    , 'database', 'password');
590                 $option('dbdata'    , 'database', 'database');
591                 $option('url'       , 'system'  , 'url');
592                 $option('phppath'   , 'config'  , 'php_path');
593                 $option('admin'     , 'config'  , 'admin_email');
594                 $option('tz'        , 'system'  , 'default_timezone');
595                 $option('lang'      , 'system'  , 'language');
596                 $option('basepath'  , 'system'  , 'basepath');
597
598                 $txt = $this->dumpExecute($console);
599
600                 self::assertFinished($txt, true);
601                 self::assertConfig($data, true, true, true, true);
602         }
603
604         /**
605          * Test the automatic installation with a wrong database connection
606          */
607         public function testNoDatabaseConnection()
608         {
609                 $this->mockConnect(false, 1);
610
611                 $this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
612                 $this->mockReplaceMacros('testTemplate', Mockery::any(), '', 1);
613
614                 $console = new AutomaticInstallation($this->consoleArgv);
615                 $console->setOption('url', 'http://friendica.local');
616
617                 $txt = $this->dumpExecute($console);
618
619                 self::assertStuckDB($txt);
620                 self::assertTrue($this->root->hasChild('config' . DIRECTORY_SEPARATOR . 'local.config.php'));
621
622                 self::assertConfig(['config' => ['hostname' => 'friendica.local'], 'system' => ['url' => 'http://friendica.local', 'ssl_policy' => 0, 'urlpath' => '']], false, true, false, true);
623         }
624
625         public function testGetHelp()
626         {
627                 // Usable to purposely fail if new commands are added without taking tests into account
628                 $theHelp = <<<HELP
629 Installation - Install Friendica automatically
630 Synopsis
631         bin/console autoinstall [-h|--help|-?] [-v] [-a] [-f]
632
633 Description
634     Installs Friendica with data based on the local.config.php file or environment variables
635
636 Notes
637     Not checking .htaccess/URL-Rewrite during CLI installation.
638
639 Options
640     -h|--help|-?            Show help information
641     -v                      Show more debug information.
642     -a                      All setup checks are required (except .htaccess)
643     -f|--file <config>      prepared config file (e.g. "config/local.config.php" itself) which will override every other config option - except the environment variables)
644     -s|--savedb               Save the DB credentials to the file (if environment variables is used)
645     -H|--dbhost <host>        The host of the mysql/mariadb database (env MYSQL_HOST)
646     -p|--dbport <port>        The port of the mysql/mariadb database (env MYSQL_PORT)
647     -d|--dbdata <database>    The name of the mysql/mariadb database (env MYSQL_DATABASE)
648     -U|--dbuser <username>    The username of the mysql/mariadb database login (env MYSQL_USER or MYSQL_USERNAME)
649     -P|--dbpass <password>    The password of the mysql/mariadb database login (env MYSQL_PASSWORD)
650     -U|--url <url>            The full base URL of Friendica - f.e. 'https://friendica.local/sub' (env FRIENDICA_URL) 
651     -B|--phppath <php_path>   The path of the PHP binary (env FRIENDICA_PHP_PATH)
652     -b|--basepath <base_path> The basepath of Friendica (env FRIENDICA_BASE_PATH)
653     -t|--tz <timezone>        The timezone of Friendica (env FRIENDICA_TZ)
654     -L|--lang <language>      The language of Friendica (env FRIENDICA_LANG)
655  
656 Environment variables
657    MYSQL_HOST                  The host of the mysql/mariadb database (mandatory if mysql and environment is used)
658    MYSQL_PORT                  The port of the mysql/mariadb database
659    MYSQL_USERNAME|MYSQL_USER   The username of the mysql/mariadb database login (MYSQL_USERNAME is for mysql, MYSQL_USER for mariadb)
660    MYSQL_PASSWORD              The password of the mysql/mariadb database login
661    MYSQL_DATABASE              The name of the mysql/mariadb database
662    FRIENDICA_URL               The full base URL of Friendica - f.e. 'https://friendica.local/sub'
663    FRIENDICA_PHP_PATH          The path of the PHP binary - leave empty for auto detection
664    FRIENDICA_BASE_PATH         The basepath of Friendica - leave empty for auto detection
665    FRIENDICA_ADMIN_MAIL        The admin email address of Friendica (this email will be used for admin access)
666    FRIENDICA_TZ                The timezone of Friendica
667    FRIENDICA_LANG              The langauge of Friendica
668    
669 Examples
670         bin/console autoinstall -f 'input.config.php
671                 Installs Friendica with the prepared 'input.config.php' file
672
673         bin/console autoinstall --savedb
674                 Installs Friendica with environment variables and saves them to the 'config/local.config.php' file
675
676         bin/console autoinstall -h localhost -p 3365 -U user -P passwort1234 -d friendica
677                 Installs Friendica with a local mysql database with credentials
678
679 HELP;
680
681                 $console = new AutomaticInstallation($this->consoleArgv);
682                 $console->setOption('help', true);
683
684                 $txt = $this->dumpExecute($console);
685
686                 self::assertEquals($theHelp, $txt);
687         }
688 }