aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Command
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2015-09-11 16:13:59 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2015-09-12 11:36:16 +0200
commitaf43bd37675954f937720f7b6fbcf78d85928bc5 (patch)
treedfcb9a7cd9a1eeac200852ef74f6fc9329e3337c /src/Wallabag/CoreBundle/Command
parent3f7a62908cc34b9d575bea5629dc0bb94e521e71 (diff)
downloadwallabag-af43bd37675954f937720f7b6fbcf78d85928bc5.tar.gz
wallabag-af43bd37675954f937720f7b6fbcf78d85928bc5.tar.zst
wallabag-af43bd37675954f937720f7b6fbcf78d85928bc5.zip
Fix tests
Ensure that created use during install command will always be unique. We assume that the install command must be run to initialize a wallabag instance. NEVER to add more user. Also, use a better way to retrieve the real name of the database and not the one defined in parameters.yml (which isn't the same for test envi because the dbname isn't defined in parameters.yml but directly in config_test.yml)
Diffstat (limited to 'src/Wallabag/CoreBundle/Command')
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 29d91109..1bd76ae3 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -273,10 +273,11 @@ class InstallCommand extends ContainerAwareCommand
273 */ 273 */
274 private function isDatabasePresent() 274 private function isDatabasePresent()
275 { 275 {
276 $databaseName = $this->getContainer()->getParameter('database_name'); 276 $connection = $this->getContainer()->get('doctrine')->getManager()->getConnection();
277 $databaseName = $connection->getDatabase();
277 278
278 try { 279 try {
279 $schemaManager = $this->getContainer()->get('doctrine')->getManager()->getConnection()->getSchemaManager(); 280 $schemaManager = $connection->getSchemaManager();
280 } catch (\Exception $exception) { 281 } catch (\Exception $exception) {
281 if (false !== strpos($exception->getMessage(), sprintf("Unknown database '%s'", $databaseName))) { 282 if (false !== strpos($exception->getMessage(), sprintf("Unknown database '%s'", $databaseName))) {
282 return false; 283 return false;