X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FWallabag%2FImportBundle%2FImport%2FFirefoxImportTest.php;h=b516fbc53e24fcb5158e5367cb4a19292367fe48;hb=f17b89fadce0a8c2280fbe1518d66f20dddce59d;hp=007dda6a2a6a901a9a8b4297cf6ba39a71f61012;hpb=12d93e6896f2d99b6329b7979ee7b6d11e457c3a;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php index 007dda6a..b516fbc5 100644 --- a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php @@ -18,7 +18,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase protected $logHandler; protected $contentProxy; - private function getFirefoxImport($unsetUser = false) + private function getFirefoxImport($unsetUser = false, $dispatched = 0) { $this->user = new User(); @@ -30,7 +30,15 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $wallabag = new FirefoxImport($this->em, $this->contentProxy); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->exactly($dispatched)) + ->method('dispatch'); + + $wallabag = new FirefoxImport($this->em, $this->contentProxy, $dispatcher); $this->logHandler = new TestHandler(); $logger = new Logger('test', [$this->logHandler]); @@ -54,7 +62,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase public function testImport() { - $firefoxImport = $this->getFirefoxImport(); + $firefoxImport = $this->getFirefoxImport(false, 2); $firefoxImport->setFilepath(__DIR__.'/../fixtures/firefox-bookmarks.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') @@ -87,7 +95,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase public function testImportAndMarkAllAsRead() { - $firefoxImport = $this->getFirefoxImport(); + $firefoxImport = $this->getFirefoxImport(false, 1); $firefoxImport->setFilepath(__DIR__.'/../fixtures/firefox-bookmarks.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')