/** * @covers Eye4web\ZfcUser\Pm\Mapper\DoctrineORM\PmMapper::isUnread */ public function testIsUnread() { $conversation = new Conversation(); $conversation->setId(1); $user = new User(); $user->setId(1); $optionsData = ['conversation' => $conversation->getId(), 'to' => $user->getId()]; $this->options->expects($this->once())->method('getConversationReceiverEntity')->will($this->returnValue('Eye4web\\ZfcUser\\Pm\\Entity\\ConversationReceiver')); $objectRepository = $this->getMock('Doctrine\\Common\\Persistence\\ObjectRepository'); $this->objectManager->expects($this->once())->method('getRepository')->with('Eye4web\\ZfcUser\\Pm\\Entity\\ConversationReceiver')->will($this->returnValue($objectRepository)); $conversationReceive = $this->getMock('Eye4web\\ZfcUser\\Pm\\Entity\\ConversationReceiver'); $objectRepository->expects($this->once())->method('findOneBy')->with($optionsData)->will($this->returnValue($conversationReceive)); $conversationReceive->expects($this->once())->method('getUnread')->will($this->returnValue(true)); $this->assertTrue($this->mapper->isUnread($conversation, $user)); }