diff options
author | adev <adev2000@gmail.com> | 2017-05-15 20:47:59 +0200 |
---|---|---|
committer | adev <adev2000@gmail.com> | 2017-05-31 16:03:54 +0200 |
commit | 7ab5eb9508921d84b4b4ec84a59135d536da748e (patch) | |
tree | 725d9fae04d07a2c0aec2d2f5a19e1b43ec7a5d1 /src/Wallabag | |
parent | 4423b88c5b2c2d530b0a83a822f521a61ca4d4b8 (diff) | |
download | wallabag-7ab5eb9508921d84b4b4ec84a59135d536da748e.tar.gz wallabag-7ab5eb9508921d84b4b4ec84a59135d536da748e.tar.zst wallabag-7ab5eb9508921d84b4b4ec84a59135d536da748e.zip |
Isolated tests
Use https://github.com/dmaicher/doctrine-test-bundle to have test isolation.
Diffstat (limited to 'src/Wallabag')
3 files changed, 11 insertions, 14 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 0d9364f6..d9608246 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php | |||
@@ -499,20 +499,18 @@ class InstallCommand extends ContainerAwareCommand | |||
499 | $output = new BufferedOutput(); | 499 | $output = new BufferedOutput(); |
500 | $exitCode = $this->getApplication()->run(new ArrayInput($parameters), $output); | 500 | $exitCode = $this->getApplication()->run(new ArrayInput($parameters), $output); |
501 | 501 | ||
502 | // PDO does not always close the connection after Doctrine commands. | ||
503 | // See https://github.com/symfony/symfony/issues/11750. | ||
504 | $this->getContainer()->get('doctrine')->getManager()->getConnection()->close(); | ||
505 | |||
502 | if (0 !== $exitCode) { | 506 | if (0 !== $exitCode) { |
503 | $this->getApplication()->setAutoExit(true); | 507 | $this->getApplication()->setAutoExit(true); |
504 | 508 | ||
505 | $this->defaultOutput->writeln(''); | 509 | throw new \RuntimeException( |
506 | $this->defaultOutput->writeln('<error>The command "'.$command.'" generates some errors: </error>'); | 510 | 'The command "'.$command."\" generates some errors: \n\n" |
507 | $this->defaultOutput->writeln($output->fetch()); | 511 | .$output->fetch()); |
508 | |||
509 | die(); | ||
510 | } | 512 | } |
511 | 513 | ||
512 | // PDO does not always close the connection after Doctrine commands. | ||
513 | // See https://github.com/symfony/symfony/issues/11750. | ||
514 | $this->getContainer()->get('doctrine')->getManager()->getConnection()->close(); | ||
515 | |||
516 | return $this; | 514 | return $this; |
517 | } | 515 | } |
518 | 516 | ||
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 1a80cc1a..0e61c642 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -250,7 +250,7 @@ class ConfigController extends Controller | |||
250 | case 'entries': | 250 | case 'entries': |
251 | // SQLite doesn't care about cascading remove, so we need to manually remove associated stuff | 251 | // SQLite doesn't care about cascading remove, so we need to manually remove associated stuff |
252 | // otherwise they won't be removed ... | 252 | // otherwise they won't be removed ... |
253 | if ($this->get('doctrine')->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) { | 253 | if ($this->get('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) { |
254 | $this->getDoctrine()->getRepository('WallabagAnnotationBundle:Annotation')->removeAllByUserId($this->getUser()->getId()); | 254 | $this->getDoctrine()->getRepository('WallabagAnnotationBundle:Annotation')->removeAllByUserId($this->getUser()->getId()); |
255 | } | 255 | } |
256 | 256 | ||
@@ -262,7 +262,7 @@ class ConfigController extends Controller | |||
262 | ->removeAllByUserId($this->getUser()->getId()); | 262 | ->removeAllByUserId($this->getUser()->getId()); |
263 | break; | 263 | break; |
264 | case 'archived': | 264 | case 'archived': |
265 | if ($this->get('doctrine')->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) { | 265 | if ($this->get('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) { |
266 | $this->removeAnnotationsForArchivedByUserId($this->getUser()->getId()); | 266 | $this->removeAnnotationsForArchivedByUserId($this->getUser()->getId()); |
267 | } | 267 | } |
268 | 268 | ||
diff --git a/src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php b/src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php index 3b4c4cf9..5e6af8cc 100644 --- a/src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php +++ b/src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php | |||
@@ -45,9 +45,8 @@ class SQLiteCascadeDeleteSubscriber implements EventSubscriber | |||
45 | public function preRemove(LifecycleEventArgs $args) | 45 | public function preRemove(LifecycleEventArgs $args) |
46 | { | 46 | { |
47 | $entity = $args->getEntity(); | 47 | $entity = $args->getEntity(); |
48 | 48 | if (!$this->doctrine->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform | |
49 | if (!$this->doctrine->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver || | 49 | || !$entity instanceof Entry) { |
50 | !$entity instanceof Entry) { | ||
51 | return; | 50 | return; |
52 | } | 51 | } |
53 | 52 | ||