N98\Magento\Command\Installer\InstallCommandTest::testInstallFailsWithInvalidDbConfigWhenAllOptionsArePassedIn PHP Method

testInstallFailsWithInvalidDbConfigWhenAllOptionsArePassedIn() public method

If all database config is passed in via options and the database validation fails, test that an exception was thrown
    public function testInstallFailsWithInvalidDbConfigWhenAllOptionsArePassedIn()
    {
        $application = $this->getApplication();
        $application->add(new InstallCommand());
        $command = $this->getApplication()->find('install');
        $command->setCliArguments(array('--dbName=magento', '--dbHost=hostWhichDoesntExist', '--dbUser=user', '--dbPass=pa$$w0rd'));
        $commandTester = new CommandTester($command);
        try {
            $commandTester->execute(array('command' => $command->getName(), '--noDownload' => true, '--installSampleData' => 'no', '--useDefaultConfigParams' => 'yes', '--installationFolder' => $this->installDir, '--dbHost' => 'hostWhichDoesNotExists', '--dbUser' => 'user', '--dbPass' => 'pa$$w0rd', '--dbName' => 'magento'));
        } catch (\InvalidArgumentException $e) {
            $this->assertEquals("Database configuration is invalid", $e->getMessage());
            $display = $commandTester->getDisplay(true);
            $this->assertContains('SQLSTATE', $display);
            return;
        }
        $this->fail('InvalidArgumentException was not raised');
    }