/** * @covers Eye4web\ZfcUser\Pm\Entity\ConversationReceiver::setConversation * @covers Eye4web\ZfcUser\Pm\Entity\ConversationReceiver::getConversation */ public function testSetGetConversation() { $conversation = new Conversation(); $conversation->setId(1); $this->conversationReceiver->setConversation($conversation); $this->assertInstanceOf('Eye4web\\ZfcUser\\Pm\\Entity\\Conversation', $this->conversationReceiver->getConversation()); }
/** * @covers Eye4web\ZfcUser\Pm\Service\PmService::getLastReply */ public function testGetLastReply() { $conversation = new Conversation(); $conversation->setHeadLine('foo'); $message = new Message(); $this->mapper->expects($this->once())->method('getLastReply')->with($conversation)->will($this->returnValue($message)); $this->assertInstanceOf('Eye4web\\ZfcUser\\Pm\\Entity\\MessageInterface', $this->service->getLastReply($conversation)); }
/** * @covers Eye4web\ZfcUser\Pm\View\Helper\ZfcUserPmHelper::isUnread */ public function testGetUnread() { $id = 1; $conversation = new Conversation(); $conversation->setId('045a4049-7c37-4053-97eb-7c6e8d1c1d64'); $user = new User(); $this->pmService->expects($this->once())->method('isUnread')->with($conversation, $user)->will($this->returnValue(true)); $this->assertTrue($this->helper->isUnread($conversation, $user)); }
/** * @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)); }
/** * @covers Eye4web\ZfcUser\Pm\Entity\Conversation::__construct * @covers Eye4web\ZfcUser\Pm\Entity\Conversation::__construct */ public function testConstructSetIdAndDate() { $conversation = new Entity(); $this->assertNotNull($conversation->getId()); $this->assertInstanceOf('DateTime', $conversation->getDate()); }