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