aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php10
-rw-r--r--tests/Wallabag/CoreBundle/Command/InstallCommandTest.php6
2 files changed, 12 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'])) {
diff --git a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php
index 089a1c5f..83f5bf24 100644
--- a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php
+++ b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php
@@ -127,6 +127,12 @@ class InstallCommandTest extends WallabagCoreTestCase
127 127
128 public function testRunInstallCommandWithDatabaseRemoved() 128 public function testRunInstallCommandWithDatabaseRemoved()
129 { 129 {
130 // skipped SQLite check when database is removed because while testing for the connection,
131 // the driver will create the file (so the database) before testing if database exist
132 if ($this->getClient()->getContainer()->get('doctrine')->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) {
133 $this->markTestSkipped('SQLite spotted: can\'t test with database removed.');
134 }
135
130 $application = new Application($this->getClient()->getKernel()); 136 $application = new Application($this->getClient()->getKernel());
131 $application->add(new DropDatabaseDoctrineCommand()); 137 $application->add(new DropDatabaseDoctrineCommand());
132 138