aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-09-11 21:40:08 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-09-11 22:15:31 +0200
commitebf5e5087d2f79ece42a660ee7bddaa3ff3ebe1e (patch)
treeb1ac70bd1d21b94e58391b9e8e2c8179afd79e0a /src/Wallabag/ImportBundle
parent03e078d060db410fe56b978cdf45d8eec5e177cb (diff)
downloadwallabag-ebf5e5087d2f79ece42a660ee7bddaa3ff3ebe1e.tar.gz
wallabag-ebf5e5087d2f79ece42a660ee7bddaa3ff3ebe1e.tar.zst
wallabag-ebf5e5087d2f79ece42a660ee7bddaa3ff3ebe1e.zip
Add tests on ImportCommand
Diffstat (limited to 'src/Wallabag/ImportBundle')
-rw-r--r--src/Wallabag/ImportBundle/Command/ImportCommand.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php
index a4aa8531..20ecc6e1 100644
--- a/src/Wallabag/ImportBundle/Command/ImportCommand.php
+++ b/src/Wallabag/ImportBundle/Command/ImportCommand.php
@@ -26,6 +26,10 @@ class ImportCommand extends ContainerAwareCommand
26 { 26 {
27 $output->writeln('Start : '.(new \DateTime())->format('d-m-Y G:i:s').' ---'); 27 $output->writeln('Start : '.(new \DateTime())->format('d-m-Y G:i:s').' ---');
28 28
29 if (!file_exists($input->getArgument('filepath'))) {
30 throw new Exception(sprintf('File "%s" not found', $input->getArgument('filepath')));
31 }
32
29 $em = $this->getContainer()->get('doctrine')->getManager(); 33 $em = $this->getContainer()->get('doctrine')->getManager();
30 // Turning off doctrine default logs queries for saving memory 34 // Turning off doctrine default logs queries for saving memory
31 $em->getConnection()->getConfiguration()->setSQLLogger(null); 35 $em->getConnection()->getConfiguration()->setSQLLogger(null);
@@ -43,9 +47,9 @@ class ImportCommand extends ContainerAwareCommand
43 } 47 }
44 48
45 $wallabag->setMarkAsRead($input->getOption('markAsRead')); 49 $wallabag->setMarkAsRead($input->getOption('markAsRead'));
50 $wallabag->setUser($user);
46 51
47 $res = $wallabag 52 $res = $wallabag
48 ->setUser($user)
49 ->setFilepath($input->getArgument('filepath')) 53 ->setFilepath($input->getArgument('filepath'))
50 ->import(); 54 ->import();
51 55