diff options
Diffstat (limited to 'tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php')
-rw-r--r-- | tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php index 75900bd7..e262a808 100644 --- a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php | |||
@@ -18,7 +18,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase | |||
18 | protected $logHandler; | 18 | protected $logHandler; |
19 | protected $contentProxy; | 19 | protected $contentProxy; |
20 | 20 | ||
21 | private function getInstapaperImport($unsetUser = false) | 21 | private function getInstapaperImport($unsetUser = false, $dispatched = 0) |
22 | { | 22 | { |
23 | $this->user = new User(); | 23 | $this->user = new User(); |
24 | 24 | ||
@@ -30,7 +30,15 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase | |||
30 | ->disableOriginalConstructor() | 30 | ->disableOriginalConstructor() |
31 | ->getMock(); | 31 | ->getMock(); |
32 | 32 | ||
33 | $import = new InstapaperImport($this->em, $this->contentProxy); | 33 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') |
34 | ->disableOriginalConstructor() | ||
35 | ->getMock(); | ||
36 | |||
37 | $dispatcher | ||
38 | ->expects($this->exactly($dispatched)) | ||
39 | ->method('dispatch'); | ||
40 | |||
41 | $import = new InstapaperImport($this->em, $this->contentProxy, $dispatcher); | ||
34 | 42 | ||
35 | $this->logHandler = new TestHandler(); | 43 | $this->logHandler = new TestHandler(); |
36 | $logger = new Logger('test', [$this->logHandler]); | 44 | $logger = new Logger('test', [$this->logHandler]); |
@@ -54,7 +62,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase | |||
54 | 62 | ||
55 | public function testImport() | 63 | public function testImport() |
56 | { | 64 | { |
57 | $instapaperImport = $this->getInstapaperImport(); | 65 | $instapaperImport = $this->getInstapaperImport(false, 3); |
58 | $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv'); | 66 | $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv'); |
59 | 67 | ||
60 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | 68 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') |
@@ -87,7 +95,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase | |||
87 | 95 | ||
88 | public function testImportAndMarkAllAsRead() | 96 | public function testImportAndMarkAllAsRead() |
89 | { | 97 | { |
90 | $instapaperImport = $this->getInstapaperImport(); | 98 | $instapaperImport = $this->getInstapaperImport(false, 1); |
91 | $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv'); | 99 | $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv'); |
92 | 100 | ||
93 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | 101 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') |