diff options
Diffstat (limited to 'tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php')
-rw-r--r-- | tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php index bea89efb..0e50b8b2 100644 --- a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php | |||
@@ -18,7 +18,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase | |||
18 | protected $logHandler; | 18 | protected $logHandler; |
19 | protected $contentProxy; | 19 | protected $contentProxy; |
20 | 20 | ||
21 | private function getWallabagV2Import($unsetUser = false) | 21 | private function getWallabagV2Import($unsetUser = false, $dispatched = 0) |
22 | { | 22 | { |
23 | $this->user = new User(); | 23 | $this->user = new User(); |
24 | 24 | ||
@@ -44,7 +44,15 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase | |||
44 | ->disableOriginalConstructor() | 44 | ->disableOriginalConstructor() |
45 | ->getMock(); | 45 | ->getMock(); |
46 | 46 | ||
47 | $wallabag = new WallabagV2Import($this->em, $this->contentProxy); | 47 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') |
48 | ->disableOriginalConstructor() | ||
49 | ->getMock(); | ||
50 | |||
51 | $dispatcher | ||
52 | ->expects($this->exactly($dispatched)) | ||
53 | ->method('dispatch'); | ||
54 | |||
55 | $wallabag = new WallabagV2Import($this->em, $this->contentProxy, $dispatcher); | ||
48 | 56 | ||
49 | $this->logHandler = new TestHandler(); | 57 | $this->logHandler = new TestHandler(); |
50 | $logger = new Logger('test', [$this->logHandler]); | 58 | $logger = new Logger('test', [$this->logHandler]); |
@@ -68,7 +76,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase | |||
68 | 76 | ||
69 | public function testImport() | 77 | public function testImport() |
70 | { | 78 | { |
71 | $wallabagV2Import = $this->getWallabagV2Import(); | 79 | $wallabagV2Import = $this->getWallabagV2Import(false, 2); |
72 | $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); | 80 | $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); |
73 | 81 | ||
74 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | 82 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') |
@@ -97,7 +105,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase | |||
97 | 105 | ||
98 | public function testImportAndMarkAllAsRead() | 106 | public function testImportAndMarkAllAsRead() |
99 | { | 107 | { |
100 | $wallabagV2Import = $this->getWallabagV2Import(); | 108 | $wallabagV2Import = $this->getWallabagV2Import(false, 2); |
101 | $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2-read.json'); | 109 | $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2-read.json'); |
102 | 110 | ||
103 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | 111 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') |
@@ -246,7 +254,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase | |||
246 | 254 | ||
247 | public function testImportWithExceptionFromGraby() | 255 | public function testImportWithExceptionFromGraby() |
248 | { | 256 | { |
249 | $wallabagV2Import = $this->getWallabagV2Import(); | 257 | $wallabagV2Import = $this->getWallabagV2Import(false, 2); |
250 | $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); | 258 | $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); |
251 | 259 | ||
252 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | 260 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') |