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