public function testFlushMessageZeroEmails() { $transport = $this->getMock('\\Swift_Transport'); $transport->expects($this->once())->method('isStarted')->will($this->returnValue(false)); $transport->expects($this->once())->method('start'); $repository = $this->getMockBuilder('Oro\\Bundle\\NotificationBundle\\Entity\\Repository\\SpoolItemRepository')->disableOriginalConstructor()->getMock(); $repository->expects($this->once())->method('findBy')->will($this->returnValue(array())); $this->em->expects($this->once())->method('getRepository')->with(self::SPOOL_ITEM_CLASS)->will($this->returnValue($repository)); $count = $this->spool->flushQueue($transport); $this->assertEquals(0, $count); }