aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/ImportBundle
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Wallabag/ImportBundle')
-rw-r--r--tests/Wallabag/ImportBundle/Command/ImportCommandTest.php31
-rw-r--r--tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php10
-rw-r--r--tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php4
-rw-r--r--tests/Wallabag/ImportBundle/Import/ChromeImportTest.php7
-rw-r--r--tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php7
-rw-r--r--tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php7
-rw-r--r--tests/Wallabag/ImportBundle/Import/PocketImportTest.php8
-rw-r--r--tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php7
-rw-r--r--tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php8
-rw-r--r--tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php8
15 files changed, 80 insertions, 27 deletions
diff --git a/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php b/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php
index 7be1eb18..7043c345 100644
--- a/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php
+++ b/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php
@@ -10,7 +10,7 @@ use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
10class ImportCommandTest extends WallabagCoreTestCase 10class ImportCommandTest extends WallabagCoreTestCase
11{ 11{
12 /** 12 /**
13 * @expectedException Symfony\Component\Console\Exception\RuntimeException 13 * @expectedException \Symfony\Component\Console\Exception\RuntimeException
14 * @expectedExceptionMessage Not enough arguments 14 * @expectedExceptionMessage Not enough arguments
15 */ 15 */
16 public function testRunImportCommandWithoutArguments() 16 public function testRunImportCommandWithoutArguments()
@@ -27,7 +27,7 @@ class ImportCommandTest extends WallabagCoreTestCase
27 } 27 }
28 28
29 /** 29 /**
30 * @expectedException Symfony\Component\Config\Definition\Exception\Exception 30 * @expectedException \Symfony\Component\Config\Definition\Exception\Exception
31 * @expectedExceptionMessage not found 31 * @expectedExceptionMessage not found
32 */ 32 */
33 public function testRunImportCommandWithoutFilepath() 33 public function testRunImportCommandWithoutFilepath()
@@ -40,16 +40,15 @@ class ImportCommandTest extends WallabagCoreTestCase
40 $tester = new CommandTester($command); 40 $tester = new CommandTester($command);
41 $tester->execute([ 41 $tester->execute([
42 'command' => $command->getName(), 42 'command' => $command->getName(),
43 'userId' => 1, 43 'username' => 'admin',
44 'filepath' => 1, 44 'filepath' => 1,
45 ]); 45 ]);
46 } 46 }
47 47
48 /** 48 /**
49 * @expectedException Symfony\Component\Config\Definition\Exception\Exception 49 * @expectedException \Doctrine\ORM\NoResultException
50 * @expectedExceptionMessage User with id
51 */ 50 */
52 public function testRunImportCommandWithoutUserId() 51 public function testRunImportCommandWithWrongUsername()
53 { 52 {
54 $application = new Application($this->getClient()->getKernel()); 53 $application = new Application($this->getClient()->getKernel());
55 $application->add(new ImportCommand()); 54 $application->add(new ImportCommand());
@@ -59,7 +58,7 @@ class ImportCommandTest extends WallabagCoreTestCase
59 $tester = new CommandTester($command); 58 $tester = new CommandTester($command);
60 $tester->execute([ 59 $tester->execute([
61 'command' => $command->getName(), 60 'command' => $command->getName(),
62 'userId' => 0, 61 'username' => 'random',
63 'filepath' => './', 62 'filepath' => './',
64 ]); 63 ]);
65 } 64 }
@@ -74,7 +73,7 @@ class ImportCommandTest extends WallabagCoreTestCase
74 $tester = new CommandTester($command); 73 $tester = new CommandTester($command);
75 $tester->execute([ 74 $tester->execute([
76 'command' => $command->getName(), 75 'command' => $command->getName(),
77 'userId' => 1, 76 'username' => 'admin',
78 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir').'/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json', 77 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir').'/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json',
79 '--importer' => 'v2', 78 '--importer' => 'v2',
80 ]); 79 ]);
@@ -82,4 +81,20 @@ class ImportCommandTest extends WallabagCoreTestCase
82 $this->assertContains('imported', $tester->getDisplay()); 81 $this->assertContains('imported', $tester->getDisplay());
83 $this->assertContains('already saved', $tester->getDisplay()); 82 $this->assertContains('already saved', $tester->getDisplay());
84 } 83 }
84
85 public function testRunImportCommandWithUserId()
86 {
87 $application = new Application($this->getClient()->getKernel());
88 $application->add(new ImportCommand());
89
90 $command = $application->find('wallabag:import');
91
92 $tester = new CommandTester($command);
93 $tester->execute([
94 'command' => $command->getName(),
95 'username' => 1,
96 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir').'/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json',
97 '--useUserId' => true,
98 ]);
99 }
85} 100}
diff --git a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php
index c1f82ea9..8e9f65e3 100644
--- a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php
@@ -120,7 +120,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
120 120
121 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.usinenouvelle.com is ok'); 121 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.usinenouvelle.com is ok');
122 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.usinenouvelle.com is ok'); 122 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.usinenouvelle.com is ok');
123 $this->assertEquals(0, count($content->getTags())); 123 $this->assertEquals(1, count($content->getTags()));
124 124
125 $createdAt = $content->getCreatedAt(); 125 $createdAt = $content->getCreatedAt();
126 $this->assertEquals('2011', $createdAt->format('Y')); 126 $this->assertEquals('2011', $createdAt->format('Y'));
diff --git a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php
index 7557ea32..5354439c 100644
--- a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php
@@ -121,19 +121,19 @@ class FirefoxControllerTest extends WallabagCoreTestCase
121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://lexpansion.lexpress.fr is ok'); 121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://lexpansion.lexpress.fr is ok');
122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://lexpansion.lexpress.fr is ok'); 122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://lexpansion.lexpress.fr is ok');
123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://lexpansion.lexpress.fr is ok'); 123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://lexpansion.lexpress.fr is ok');
124 $this->assertEquals(2, count($content->getTags())); 124 $this->assertEquals(3, count($content->getTags()));
125 125
126 $content = $client->getContainer() 126 $content = $client->getContainer()
127 ->get('doctrine.orm.entity_manager') 127 ->get('doctrine.orm.entity_manager')
128 ->getRepository('WallabagCoreBundle:Entry') 128 ->getRepository('WallabagCoreBundle:Entry')
129 ->findByUrlAndUserId( 129 ->findByUrlAndUserId(
130 'http://stackoverflow.com/questions/15017163/parser-for-exported-bookmarks-html-file-of-google-chrome-and-mozilla-in-java', 130 'https://stackoverflow.com/questions/15017163/parser-for-exported-bookmarks-html-file-of-google-chrome-and-mozilla-in-java',
131 $this->getLoggedInUserId() 131 $this->getLoggedInUserId()
132 ); 132 );
133 133
134 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://stackoverflow.com is ok'); 134 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://stackoverflow.com is ok');
135 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://stackoverflow.com is ok'); 135 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://stackoverflow.com is ok');
136 $this->assertEmpty($content->getLanguage(), 'Language for http://stackoverflow.com is ok'); 136 $this->assertEmpty($content->getLanguage(), 'Language for https://stackoverflow.com is ok');
137 137
138 $createdAt = $content->getCreatedAt(); 138 $createdAt = $content->getCreatedAt();
139 $this->assertEquals('2013', $createdAt->format('Y')); 139 $this->assertEquals('2013', $createdAt->format('Y'));
diff --git a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php
index 3f6f2b9f..c2e5fdb7 100644
--- a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php
@@ -121,7 +121,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is ok'); 121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is ok');
122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok'); 122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok');
123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok'); 123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok');
124 $this->assertEquals(0, count($content->getTags())); 124 $this->assertEquals(1, count($content->getTags()));
125 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 125 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
126 } 126 }
127 127
diff --git a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
index 75a7e332..96b32484 100644
--- a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
@@ -121,7 +121,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://ma.ttias.be is ok'); 121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://ma.ttias.be is ok');
122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://ma.ttias.be is ok'); 122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://ma.ttias.be is ok');
123 $this->assertNotEmpty($content->getLanguage(), 'Language for https://ma.ttias.be is ok'); 123 $this->assertNotEmpty($content->getLanguage(), 'Language for https://ma.ttias.be is ok');
124 $this->assertEquals(2, count($content->getTags())); 124 $this->assertEquals(3, count($content->getTags()));
125 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 125 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
126 $this->assertEquals('2016-10-26', $content->getCreatedAt()->format('Y-m-d')); 126 $this->assertEquals('2016-10-26', $content->getCreatedAt()->format('Y-m-d'));
127 } 127 }
diff --git a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
index acb61ca1..e6d33fe9 100644
--- a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
@@ -121,7 +121,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.zataz.com is ok'); 121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.zataz.com is ok');
122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.zataz.com is ok'); 122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.zataz.com is ok');
123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.zataz.com is ok'); 123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.zataz.com is ok');
124 $this->assertEquals(0, count($content->getTags())); 124 $this->assertEquals(1, count($content->getTags()));
125 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 125 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
126 $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); 126 $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d'));
127 } 127 }
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
index acc39997..0c7f97ed 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
@@ -129,7 +129,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
129 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.framablog.org is ok'); 129 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.framablog.org is ok');
130 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.framablog.org is ok'); 130 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.framablog.org is ok');
131 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.framablog.org is ok'); 131 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.framablog.org is ok');
132 $this->assertEquals(1, count($content->getTags())); 132 $this->assertEquals(2, count($content->getTags()));
133 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 133 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
134 } 134 }
135 135
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
index 26e2f40b..556ab1bd 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
@@ -122,7 +122,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
122 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is ok'); 122 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is ok');
123 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok'); 123 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok');
124 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok'); 124 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok');
125 $this->assertEquals(0, count($content->getTags())); 125 $this->assertEquals(1, count($content->getTags()));
126 126
127 $content = $client->getContainer() 127 $content = $client->getContainer()
128 ->get('doctrine.orm.entity_manager') 128 ->get('doctrine.orm.entity_manager')
@@ -135,7 +135,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
135 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.mediapart.fr is ok'); 135 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.mediapart.fr is ok');
136 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.mediapart.fr is ok'); 136 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.mediapart.fr is ok');
137 $this->assertNotEmpty($content->getLanguage(), 'Language for https://www.mediapart.fr is ok'); 137 $this->assertNotEmpty($content->getLanguage(), 'Language for https://www.mediapart.fr is ok');
138 $this->assertEquals(2, count($content->getTags())); 138 $this->assertEquals(3, count($content->getTags()));
139 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 139 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
140 $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); 140 $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d'));
141 } 141 }
diff --git a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php
index 6b3adda4..cec19534 100644
--- a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php
@@ -17,6 +17,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
17 protected $em; 17 protected $em;
18 protected $logHandler; 18 protected $logHandler;
19 protected $contentProxy; 19 protected $contentProxy;
20 protected $tagsAssigner;
20 21
21 private function getChromeImport($unsetUser = false, $dispatched = 0) 22 private function getChromeImport($unsetUser = false, $dispatched = 0)
22 { 23 {
@@ -30,6 +31,10 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
30 ->disableOriginalConstructor() 31 ->disableOriginalConstructor()
31 ->getMock(); 32 ->getMock();
32 33
34 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
35 ->disableOriginalConstructor()
36 ->getMock();
37
33 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') 38 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
34 ->disableOriginalConstructor() 39 ->disableOriginalConstructor()
35 ->getMock(); 40 ->getMock();
@@ -38,7 +43,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase
38 ->expects($this->exactly($dispatched)) 43 ->expects($this->exactly($dispatched))
39 ->method('dispatch'); 44 ->method('dispatch');
40 45
41 $wallabag = new ChromeImport($this->em, $this->contentProxy, $dispatcher); 46 $wallabag = new ChromeImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
42 47
43 $this->logHandler = new TestHandler(); 48 $this->logHandler = new TestHandler();
44 $logger = new Logger('test', [$this->logHandler]); 49 $logger = new Logger('test', [$this->logHandler]);
diff --git a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php
index b516fbc5..c186c820 100644
--- a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php
@@ -17,6 +17,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
17 protected $em; 17 protected $em;
18 protected $logHandler; 18 protected $logHandler;
19 protected $contentProxy; 19 protected $contentProxy;
20 protected $tagsAssigner;
20 21
21 private function getFirefoxImport($unsetUser = false, $dispatched = 0) 22 private function getFirefoxImport($unsetUser = false, $dispatched = 0)
22 { 23 {
@@ -30,6 +31,10 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
30 ->disableOriginalConstructor() 31 ->disableOriginalConstructor()
31 ->getMock(); 32 ->getMock();
32 33
34 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
35 ->disableOriginalConstructor()
36 ->getMock();
37
33 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') 38 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
34 ->disableOriginalConstructor() 39 ->disableOriginalConstructor()
35 ->getMock(); 40 ->getMock();
@@ -38,7 +43,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
38 ->expects($this->exactly($dispatched)) 43 ->expects($this->exactly($dispatched))
39 ->method('dispatch'); 44 ->method('dispatch');
40 45
41 $wallabag = new FirefoxImport($this->em, $this->contentProxy, $dispatcher); 46 $wallabag = new FirefoxImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
42 47
43 $this->logHandler = new TestHandler(); 48 $this->logHandler = new TestHandler();
44 $logger = new Logger('test', [$this->logHandler]); 49 $logger = new Logger('test', [$this->logHandler]);
diff --git a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php
index e262a808..6777a02e 100644
--- a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php
@@ -17,6 +17,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
17 protected $em; 17 protected $em;
18 protected $logHandler; 18 protected $logHandler;
19 protected $contentProxy; 19 protected $contentProxy;
20 protected $tagsAssigner;
20 21
21 private function getInstapaperImport($unsetUser = false, $dispatched = 0) 22 private function getInstapaperImport($unsetUser = false, $dispatched = 0)
22 { 23 {
@@ -30,6 +31,10 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
30 ->disableOriginalConstructor() 31 ->disableOriginalConstructor()
31 ->getMock(); 32 ->getMock();
32 33
34 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
35 ->disableOriginalConstructor()
36 ->getMock();
37
33 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') 38 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
34 ->disableOriginalConstructor() 39 ->disableOriginalConstructor()
35 ->getMock(); 40 ->getMock();
@@ -38,7 +43,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase
38 ->expects($this->exactly($dispatched)) 43 ->expects($this->exactly($dispatched))
39 ->method('dispatch'); 44 ->method('dispatch');
40 45
41 $import = new InstapaperImport($this->em, $this->contentProxy, $dispatcher); 46 $import = new InstapaperImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
42 47
43 $this->logHandler = new TestHandler(); 48 $this->logHandler = new TestHandler();
44 $logger = new Logger('test', [$this->logHandler]); 49 $logger = new Logger('test', [$this->logHandler]);
diff --git a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
index 141ece36..b81ebe15 100644
--- a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
@@ -23,6 +23,8 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
23 protected $em; 23 protected $em;
24 protected $contentProxy; 24 protected $contentProxy;
25 protected $logHandler; 25 protected $logHandler;
26 protected $tagsAssigner;
27 protected $uow;
26 28
27 private function getPocketImport($consumerKey = 'ConsumerKey', $dispatched = 0) 29 private function getPocketImport($consumerKey = 'ConsumerKey', $dispatched = 0)
28 { 30 {
@@ -37,6 +39,10 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
37 ->disableOriginalConstructor() 39 ->disableOriginalConstructor()
38 ->getMock(); 40 ->getMock();
39 41
42 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
43 ->disableOriginalConstructor()
44 ->getMock();
45
40 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') 46 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
41 ->disableOriginalConstructor() 47 ->disableOriginalConstructor()
42 ->getMock(); 48 ->getMock();
@@ -63,7 +69,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
63 ->expects($this->exactly($dispatched)) 69 ->expects($this->exactly($dispatched))
64 ->method('dispatch'); 70 ->method('dispatch');
65 71
66 $pocket = new PocketImport($this->em, $this->contentProxy, $dispatcher); 72 $pocket = new PocketImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
67 $pocket->setUser($this->user); 73 $pocket->setUser($this->user);
68 74
69 $this->logHandler = new TestHandler(); 75 $this->logHandler = new TestHandler();
diff --git a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
index d1bbe648..254f0a25 100644
--- a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
@@ -17,6 +17,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
17 protected $em; 17 protected $em;
18 protected $logHandler; 18 protected $logHandler;
19 protected $contentProxy; 19 protected $contentProxy;
20 protected $tagsAssigner;
20 21
21 private function getReadabilityImport($unsetUser = false, $dispatched = 0) 22 private function getReadabilityImport($unsetUser = false, $dispatched = 0)
22 { 23 {
@@ -30,6 +31,10 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
30 ->disableOriginalConstructor() 31 ->disableOriginalConstructor()
31 ->getMock(); 32 ->getMock();
32 33
34 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
35 ->disableOriginalConstructor()
36 ->getMock();
37
33 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') 38 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
34 ->disableOriginalConstructor() 39 ->disableOriginalConstructor()
35 ->getMock(); 40 ->getMock();
@@ -38,7 +43,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
38 ->expects($this->exactly($dispatched)) 43 ->expects($this->exactly($dispatched))
39 ->method('dispatch'); 44 ->method('dispatch');
40 45
41 $wallabag = new ReadabilityImport($this->em, $this->contentProxy, $dispatcher); 46 $wallabag = new ReadabilityImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
42 47
43 $this->logHandler = new TestHandler(); 48 $this->logHandler = new TestHandler();
44 $logger = new Logger('test', [$this->logHandler]); 49 $logger = new Logger('test', [$this->logHandler]);
diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php
index 4dbced60..9f0c5bac 100644
--- a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php
@@ -17,6 +17,8 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
17 protected $em; 17 protected $em;
18 protected $logHandler; 18 protected $logHandler;
19 protected $contentProxy; 19 protected $contentProxy;
20 protected $tagsAssigner;
21 protected $uow;
20 22
21 private function getWallabagV1Import($unsetUser = false, $dispatched = 0) 23 private function getWallabagV1Import($unsetUser = false, $dispatched = 0)
22 { 24 {
@@ -44,6 +46,10 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
44 ->disableOriginalConstructor() 46 ->disableOriginalConstructor()
45 ->getMock(); 47 ->getMock();
46 48
49 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
50 ->disableOriginalConstructor()
51 ->getMock();
52
47 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') 53 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
48 ->disableOriginalConstructor() 54 ->disableOriginalConstructor()
49 ->getMock(); 55 ->getMock();
@@ -52,7 +58,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
52 ->expects($this->exactly($dispatched)) 58 ->expects($this->exactly($dispatched))
53 ->method('dispatch'); 59 ->method('dispatch');
54 60
55 $wallabag = new WallabagV1Import($this->em, $this->contentProxy, $dispatcher); 61 $wallabag = new WallabagV1Import($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
56 62
57 $this->logHandler = new TestHandler(); 63 $this->logHandler = new TestHandler();
58 $logger = new Logger('test', [$this->logHandler]); 64 $logger = new Logger('test', [$this->logHandler]);
diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php
index 0e50b8b2..efcaeb9e 100644
--- a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php
@@ -17,6 +17,8 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
17 protected $em; 17 protected $em;
18 protected $logHandler; 18 protected $logHandler;
19 protected $contentProxy; 19 protected $contentProxy;
20 protected $tagsAssigner;
21 protected $uow;
20 22
21 private function getWallabagV2Import($unsetUser = false, $dispatched = 0) 23 private function getWallabagV2Import($unsetUser = false, $dispatched = 0)
22 { 24 {
@@ -44,6 +46,10 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
44 ->disableOriginalConstructor() 46 ->disableOriginalConstructor()
45 ->getMock(); 47 ->getMock();
46 48
49 $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
50 ->disableOriginalConstructor()
51 ->getMock();
52
47 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') 53 $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
48 ->disableOriginalConstructor() 54 ->disableOriginalConstructor()
49 ->getMock(); 55 ->getMock();
@@ -52,7 +58,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
52 ->expects($this->exactly($dispatched)) 58 ->expects($this->exactly($dispatched))
53 ->method('dispatch'); 59 ->method('dispatch');
54 60
55 $wallabag = new WallabagV2Import($this->em, $this->contentProxy, $dispatcher); 61 $wallabag = new WallabagV2Import($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
56 62
57 $this->logHandler = new TestHandler(); 63 $this->logHandler = new TestHandler();
58 $logger = new Logger('test', [$this->logHandler]); 64 $logger = new Logger('test', [$this->logHandler]);