/** * Gets the number of unread messages in the inbox of the current user * * @return int */ public function countInboxNew() { if (!array_key_exists('count_inbox_new', $this->cache)) { $participant = $this->participantProvider->getAuthenticatedParticipant(); $this->cache['count_inbox_new'] = $this->provider->countInboxNewThreads($participant); } return $this->cache['count_inbox_new']; }
public function testCountInbox() { $this->participantProvider->expects($this->once())->method('getAuthenticatedParticipant')->will($this->returnValue($this->participant)); $this->provider->expects($this->once())->method('countInboxNewThreads')->with($this->participant)->will($this->returnValue(3)); $this->assertEquals(3, $this->extension->countInboxNew()); }