/** * @return string */ public function sendAction() { $queueSize = $this->options->getQueueSize(); $throttleSize = $this->mailThrottle->getThrottleSize(); if ($queueSize < 1 || 0 === $throttleSize) { $this->logger->err('Can not send anything.'); return ''; } $currentQueueSize = $throttleSize > 0 ? min($queueSize, $throttleSize) : $queueSize; $readyQueue = $this->queueItemRepository->getReadyQueue($currentQueueSize); $this->processQueueToSend($readyQueue); if ($this->hasCacheStorage()) { $this->cacheStorage->setItem(\DmMailer\View\DataProvider\Kpi::CS_LAST_MESSAGE_SENDING, $this->getTime()); } return ''; }
/** * @covers DmMailer\Repository\QueueItem */ public function testGetReadyQueue() { $actualResult = $this->sut->getReadyQueue(1)[0]; $this->assertInstanceOf('DmMailer\\Entity\\QueueItem', $actualResult); $this->assertEquals('*****@*****.**', $actualResult->getSubscriber()->getEmailAddress()); $this->assertEquals('Festivals: Halloween', $actualResult->getMessage()->getSubject()); }