From 7816eb622df2353cea0ede0a3674d5eb3a01a1a9 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 2 Nov 2016 07:10:23 +0100 Subject: Add entry.saved event to import & rest --- tests/Wallabag/ImportBundle/Import/ChromeImportTest.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'tests/Wallabag/ImportBundle/Import/ChromeImportTest.php') diff --git a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php index 1e52615c..6b3adda4 100644 --- a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php @@ -18,7 +18,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase protected $logHandler; protected $contentProxy; - private function getChromeImport($unsetUser = false) + private function getChromeImport($unsetUser = false, $dispatched = 0) { $this->user = new User(); @@ -30,7 +30,15 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $wallabag = new ChromeImport($this->em, $this->contentProxy); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->exactly($dispatched)) + ->method('dispatch'); + + $wallabag = new ChromeImport($this->em, $this->contentProxy, $dispatcher); $this->logHandler = new TestHandler(); $logger = new Logger('test', [$this->logHandler]); @@ -54,7 +62,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase public function testImport() { - $chromeImport = $this->getChromeImport(); + $chromeImport = $this->getChromeImport(false, 1); $chromeImport->setFilepath(__DIR__.'/../fixtures/chrome-bookmarks'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') @@ -87,7 +95,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase public function testImportAndMarkAllAsRead() { - $chromeImport = $this->getChromeImport(); + $chromeImport = $this->getChromeImport(false, 1); $chromeImport->setFilepath(__DIR__.'/../fixtures/chrome-bookmarks'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') -- cgit v1.2.3