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