From f62c3faf88fbc1c2a484854019d17ff377836717 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 3 Sep 2016 10:34:27 +0200 Subject: Update test If the database isn't found when checking for the connection it means, we can connect to the server. The InstallCommand will create the database later. Also, when checking for the SQLite connection, Doctrine creates the file (so the database). That's why the test is skipped for SQLite. --- src/Wallabag/CoreBundle/Command/InstallCommand.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 50d0dfff..cd816149 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -96,9 +96,11 @@ class InstallCommand extends ContainerAwareCommand try { $this->getContainer()->get('doctrine')->getManager()->getConnection()->connect(); } catch (\Exception $e) { - $fulfilled = false; - $status = 'ERROR!'; - $help = 'Can\'t connect to the database: '.$e->getMessage(); + if (false === strpos($e->getMessage(), "Unknown database")) { + $fulfilled = false; + $status = 'ERROR!'; + $help = 'Can\'t connect to the database: '.$e->getMessage(); + } } $rows[] = [$label, $status, $help]; @@ -472,7 +474,7 @@ class InstallCommand extends ContainerAwareCommand } // custom verification for sqlite, since `getListDatabasesSQL` doesn't work for sqlite - if ('sqlite' == $schemaManager->getDatabasePlatform()->getName()) { + if ('sqlite' === $schemaManager->getDatabasePlatform()->getName()) { $params = $this->getContainer()->get('doctrine.dbal.default_connection')->getParams(); if (isset($params['path']) && file_exists($params['path'])) { -- cgit v1.2.3