X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FWallabag%2FImportBundle%2FConsumer%2FRedisEntryConsumerTest.php;h=9506ff639b95bfbedce6cc3a01a9a284f93fe9d0;hb=f808b01692a835673f328d7221ba8c212caa9b61;hp=01a92ad2a660c8d6fae4884737e02e7f2ccab584;hpb=f99ddbc6f82b0e5619d51ec4415738bf34d350b6;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php b/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php index 01a92ad2..9506ff63 100644 --- a/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php +++ b/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php @@ -2,9 +2,9 @@ namespace Tests\Wallabag\ImportBundle\Consumer\AMQP; +use Wallabag\CoreBundle\Entity\Entry; use Wallabag\ImportBundle\Consumer\RedisEntryConsumer; use Wallabag\UserBundle\Entity\User; -use Wallabag\CoreBundle\Entity\Entry; class RedisEntryConsumerTest extends \PHPUnit_Framework_TestCase { @@ -111,10 +111,19 @@ JSON; ->with(json_decode($body, true)) ->willReturn($entry); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->once()) + ->method('dispatch'); + $consumer = new RedisEntryConsumer( $em, $userRepository, - $import + $import, + $dispatcher ); $res = $consumer->manage($body); @@ -156,15 +165,24 @@ JSON; ->disableOriginalConstructor() ->getMock(); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->never()) + ->method('dispatch'); + $consumer = new RedisEntryConsumer( $em, $userRepository, - $import + $import, + $dispatcher ); $res = $consumer->manage($body); - $this->assertFalse($res); + $this->assertTrue($res); } public function testMessageWithEntryProcessed() @@ -211,10 +229,19 @@ JSON; ->with(json_decode($body, true)) ->willReturn(null); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->never()) + ->method('dispatch'); + $consumer = new RedisEntryConsumer( $em, $userRepository, - $import + $import, + $dispatcher ); $res = $consumer->manage($body);