diff --git a/phpunit/0_Install/FusinvInstallTest.php b/phpunit/0_Install/FusinvInstallTest.php index 87777213ea..12046f054b 100644 --- a/phpunit/0_Install/FusinvInstallTest.php +++ b/phpunit/0_Install/FusinvInstallTest.php @@ -95,9 +95,9 @@ public function testForceInstall() { function install($force = false) { $output = []; $returncode = 0; - $command = "php -f ".FUSINV_ROOT. "/scripts/cli_install.php -- --as-user 'glpi'"; + $command = "php -f ".FUSINV_ROOT. "/scripts/cli_install.php"; if ($force) { - $command.= " --force-install"; + $command.= " -- --as-user 'glpi' --force-install"; } exec($command, $output, $returncode); $this->assertEquals(0, $returncode, diff --git a/scripts/cli_install.php b/scripts/cli_install.php index 9549e9f780..57ed1b5271 100755 --- a/scripts/cli_install.php +++ b/scripts/cli_install.php @@ -104,9 +104,14 @@ die("GLPI not installed\n"); } +$user = new User(); if (!is_null($args['--as-user'])) { - $user = new User(); $user->getFromDBbyName($args['--as-user']); +} else if (is_null($args['--as-user'])) { + $user->getFromDBbyName('glpi'); +} + +if (!$user->isNewItem()) { $auth = new Auth(); $auth->auth_succeded = true; $auth->user = $user;