diff options
Diffstat (limited to 'tests/Wallabag/ImportBundle/Import/PocketImportTest.php')
-rw-r--r-- | tests/Wallabag/ImportBundle/Import/PocketImportTest.php | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php index 9ec7935c..141ece36 100644 --- a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php | |||
@@ -24,7 +24,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase | |||
24 | protected $contentProxy; | 24 | protected $contentProxy; |
25 | protected $logHandler; | 25 | protected $logHandler; |
26 | 26 | ||
27 | private function getPocketImport($consumerKey = 'ConsumerKey') | 27 | private function getPocketImport($consumerKey = 'ConsumerKey', $dispatched = 0) |
28 | { | 28 | { |
29 | $this->user = new User(); | 29 | $this->user = new User(); |
30 | 30 | ||
@@ -55,10 +55,15 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase | |||
55 | ->method('getScheduledEntityInsertions') | 55 | ->method('getScheduledEntityInsertions') |
56 | ->willReturn([]); | 56 | ->willReturn([]); |
57 | 57 | ||
58 | $pocket = new PocketImport( | 58 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') |
59 | $this->em, | 59 | ->disableOriginalConstructor() |
60 | $this->contentProxy | 60 | ->getMock(); |
61 | ); | 61 | |
62 | $dispatcher | ||
63 | ->expects($this->exactly($dispatched)) | ||
64 | ->method('dispatch'); | ||
65 | |||
66 | $pocket = new PocketImport($this->em, $this->contentProxy, $dispatcher); | ||
62 | $pocket->setUser($this->user); | 67 | $pocket->setUser($this->user); |
63 | 68 | ||
64 | $this->logHandler = new TestHandler(); | 69 | $this->logHandler = new TestHandler(); |
@@ -252,7 +257,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase | |||
252 | 257 | ||
253 | $client->getEmitter()->attach($mock); | 258 | $client->getEmitter()->attach($mock); |
254 | 259 | ||
255 | $pocketImport = $this->getPocketImport(); | 260 | $pocketImport = $this->getPocketImport('ConsumerKey', 1); |
256 | 261 | ||
257 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | 262 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') |
258 | ->disableOriginalConstructor() | 263 | ->disableOriginalConstructor() |
@@ -339,7 +344,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase | |||
339 | 344 | ||
340 | $client->getEmitter()->attach($mock); | 345 | $client->getEmitter()->attach($mock); |
341 | 346 | ||
342 | $pocketImport = $this->getPocketImport(); | 347 | $pocketImport = $this->getPocketImport('ConsumerKey', 2); |
343 | 348 | ||
344 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | 349 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') |
345 | ->disableOriginalConstructor() | 350 | ->disableOriginalConstructor() |
@@ -591,7 +596,7 @@ JSON; | |||
591 | 596 | ||
592 | $client->getEmitter()->attach($mock); | 597 | $client->getEmitter()->attach($mock); |
593 | 598 | ||
594 | $pocketImport = $this->getPocketImport(); | 599 | $pocketImport = $this->getPocketImport('ConsumerKey', 1); |
595 | 600 | ||
596 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | 601 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') |
597 | ->disableOriginalConstructor() | 602 | ->disableOriginalConstructor() |