diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-09-03 10:34:27 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-09-03 10:34:27 +0200 |
commit | f62c3faf88fbc1c2a484854019d17ff377836717 (patch) | |
tree | f45c1bf0f44d6485a129b39764935e202bf624b9 /src | |
parent | 001a7bad66fd1ce2b208abfe89177e72b5e1baa5 (diff) | |
download | wallabag-f62c3faf88fbc1c2a484854019d17ff377836717.tar.gz wallabag-f62c3faf88fbc1c2a484854019d17ff377836717.tar.zst wallabag-f62c3faf88fbc1c2a484854019d17ff377836717.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/Wallabag/CoreBundle/Command/InstallCommand.php | 10 |
1 files changed, 6 insertions, 4 deletions
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 | |||
96 | try { | 96 | try { |
97 | $this->getContainer()->get('doctrine')->getManager()->getConnection()->connect(); | 97 | $this->getContainer()->get('doctrine')->getManager()->getConnection()->connect(); |
98 | } catch (\Exception $e) { | 98 | } catch (\Exception $e) { |
99 | $fulfilled = false; | 99 | if (false === strpos($e->getMessage(), "Unknown database")) { |
100 | $status = '<error>ERROR!</error>'; | 100 | $fulfilled = false; |
101 | $help = 'Can\'t connect to the database: '.$e->getMessage(); | 101 | $status = '<error>ERROR!</error>'; |
102 | $help = 'Can\'t connect to the database: '.$e->getMessage(); | ||
103 | } | ||
102 | } | 104 | } |
103 | 105 | ||
104 | $rows[] = [$label, $status, $help]; | 106 | $rows[] = [$label, $status, $help]; |
@@ -472,7 +474,7 @@ class InstallCommand extends ContainerAwareCommand | |||
472 | } | 474 | } |
473 | 475 | ||
474 | // custom verification for sqlite, since `getListDatabasesSQL` doesn't work for sqlite | 476 | // custom verification for sqlite, since `getListDatabasesSQL` doesn't work for sqlite |
475 | if ('sqlite' == $schemaManager->getDatabasePlatform()->getName()) { | 477 | if ('sqlite' === $schemaManager->getDatabasePlatform()->getName()) { |
476 | $params = $this->getContainer()->get('doctrine.dbal.default_connection')->getParams(); | 478 | $params = $this->getContainer()->get('doctrine.dbal.default_connection')->getParams(); |
477 | 479 | ||
478 | if (isset($params['path']) && file_exists($params['path'])) { | 480 | if (isset($params['path']) && file_exists($params['path'])) { |