diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 29d91109e..1bd76ae36 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -273,10 +273,11 @@ class InstallCommand extends ContainerAwareCommand */ private function isDatabasePresent() { - $databaseName = $this->getContainer()->getParameter('database_name'); + $connection = $this->getContainer()->get('doctrine')->getManager()->getConnection(); + $databaseName = $connection->getDatabase(); try { - $schemaManager = $this->getContainer()->get('doctrine')->getManager()->getConnection()->getSchemaManager(); + $schemaManager = $connection->getSchemaManager(); } catch (\Exception $exception) { if (false !== strpos($exception->getMessage(), sprintf("Unknown database '%s'", $databaseName))) { return false; diff --git a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php index 3067e5a4d..24910e605 100644 --- a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php +++ b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php @@ -41,7 +41,7 @@ class InstallCommandTest extends WallabagCoreTestCase ->getMock(); $dialog->expects($this->any()) ->method('ask') - ->will($this->returnValue('test')); + ->will($this->returnValue('test_'.uniqid('', true))); $dialog->expects($this->any()) ->method('askConfirmation') ->will($this->returnValue(true)); @@ -75,7 +75,7 @@ class InstallCommandTest extends WallabagCoreTestCase ->getMock(); $dialog->expects($this->any()) ->method('ask') - ->will($this->returnValue('test2')); + ->will($this->returnValue('test_'.uniqid('', true))); $dialog->expects($this->any()) ->method('askConfirmation') ->will($this->returnValue(true)); @@ -125,7 +125,7 @@ class InstallCommandTest extends WallabagCoreTestCase ->getMock(); $dialog->expects($this->any()) ->method('ask') - ->will($this->returnValue('test')); + ->will($this->returnValue('test_'.uniqid('', true))); $dialog->expects($this->any()) ->method('askConfirmation') ->will($this->returnValue(true)); @@ -259,7 +259,7 @@ class InstallCommandTest extends WallabagCoreTestCase ->getMock(); $dialog->expects($this->any()) ->method('ask') - ->will($this->returnValue('test')); + ->will($this->returnValue('test_'.uniqid('', true))); $dialog->expects($this->any()) ->method('askConfirmation') ->will($this->returnValue(true)); diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index a09662858..a92835b31 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php @@ -209,7 +209,7 @@ class EntryControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') ->getRepository('WallabagCoreBundle:Entry') - ->findOneById(1); + ->findOneByIsStarred(false); $client->request('GET', '/delete/'.$content->getId()); @@ -360,13 +360,13 @@ class EntryControllerTest extends WallabagCoreTestCase $form['entry_filter[isStarred]']->untick(); $crawler = $client->submit($form); - $this->assertCount(1, $crawler->filter('div[class=entry]')); + $this->assertCount(2, $crawler->filter('div[class=entry]')); $form = $crawler->filter('button[id=submit-filter]')->form(); $form['entry_filter[isArchived]']->untick(); $form['entry_filter[isStarred]']->tick(); $crawler = $client->submit($form); - $this->assertCount(1, $crawler->filter('div[class=entry]')); + $this->assertCount(2, $crawler->filter('div[class=entry]')); } } diff --git a/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php index af39d6ce1..d25b2db5f 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php @@ -24,7 +24,7 @@ class TagControllerTest extends WallabagCoreTestCase $entry = $client->getContainer() ->get('doctrine.orm.entity_manager') ->getRepository('WallabagCoreBundle:Entry') - ->findOneByIsArchived(false); + ->findOneBy(array()); $crawler = $client->request('GET', '/view/'.$entry->getId());