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