1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-07-12 16:58:37 +00:00

Merge pull request #3137 from aaa2000/isolated-tests

Isolated tests
This commit is contained in:
Jérémy Benoist 2017-06-01 07:58:17 +02:00 committed by GitHub
commit 2a0eec07a5
23 changed files with 464 additions and 284 deletions

View file

@ -499,20 +499,18 @@ class InstallCommand extends ContainerAwareCommand
$output = new BufferedOutput();
$exitCode = $this->getApplication()->run(new ArrayInput($parameters), $output);
if (0 !== $exitCode) {
$this->getApplication()->setAutoExit(true);
$this->defaultOutput->writeln('');
$this->defaultOutput->writeln('<error>The command "'.$command.'" generates some errors: </error>');
$this->defaultOutput->writeln($output->fetch());
die();
}
// PDO does not always close the connection after Doctrine commands.
// See https://github.com/symfony/symfony/issues/11750.
$this->getContainer()->get('doctrine')->getManager()->getConnection()->close();
if (0 !== $exitCode) {
$this->getApplication()->setAutoExit(true);
throw new \RuntimeException(
'The command "'.$command."\" generates some errors: \n\n"
.$output->fetch());
}
return $this;
}

View file

@ -250,7 +250,7 @@ class ConfigController extends Controller
case 'entries':
// SQLite doesn't care about cascading remove, so we need to manually remove associated stuff
// otherwise they won't be removed ...
if ($this->get('doctrine')->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) {
if ($this->get('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
$this->getDoctrine()->getRepository('WallabagAnnotationBundle:Annotation')->removeAllByUserId($this->getUser()->getId());
}
@ -262,7 +262,7 @@ class ConfigController extends Controller
->removeAllByUserId($this->getUser()->getId());
break;
case 'archived':
if ($this->get('doctrine')->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) {
if ($this->get('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
$this->removeAnnotationsForArchivedByUserId($this->getUser()->getId());
}

View file

@ -45,9 +45,8 @@ class SQLiteCascadeDeleteSubscriber implements EventSubscriber
public function preRemove(LifecycleEventArgs $args)
{
$entity = $args->getEntity();
if (!$this->doctrine->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver ||
!$entity instanceof Entry) {
if (!$this->doctrine->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform
|| !$entity instanceof Entry) {
return;
}