diff options
author | Thomas Citharel <tcit@tcit.fr> | 2017-05-28 21:50:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-28 21:50:23 +0200 |
commit | b788add08787863ac2a0e68ddaf4620da4b2b33c (patch) | |
tree | 520242e7454abd9e4562d250a5be46496d41b9a6 /tests/Wallabag/ImportBundle | |
parent | 35941d57ee4d06ec3557d4b126d5f6fd263bcf3a (diff) | |
parent | de8d2a9005321a935e52f4471f031f73bb240412 (diff) | |
download | wallabag-b788add08787863ac2a0e68ddaf4620da4b2b33c.tar.gz wallabag-b788add08787863ac2a0e68ddaf4620da4b2b33c.tar.zst wallabag-b788add08787863ac2a0e68ddaf4620da4b2b33c.zip |
Merge pull request #3153 from wallabag/content-proxy-refactor
Move Tags assigner to a separate file
Diffstat (limited to 'tests/Wallabag/ImportBundle')
7 files changed, 45 insertions, 7 deletions
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]); |