/** * @param array $responses * * @return \Generated\Shared\Transfer\SendMailResponsesTransfer */ protected function convertResponsesToTransfer($responses) { $responsesTransfer = new SendMailResponsesTransfer(); foreach ($responses as $response) { $responseTransfer = new SendMailResponseTransfer(); $responseTransfer->setEmail($response['email']); $responseTransfer->setIsSent($response['status'] === self::STATUS_SENT); $responseTransfer->setIsQueued($response['status'] === self::STATUS_QUEUED); $responseTransfer->setIsRejected($response['status'] === self::STATUS_REJECTED); $responseTransfer->setIsInvalid($response['status'] === self::STATUS_INVALID); $responseTransfer->setRejectReason($response['reject_reason']); $responseTransfer->setIdMessage($response['_id']); $responsesTransfer->addResponse($responseTransfer); } return $responsesTransfer; }
/** * @return void */ public function testIsMailSentReturnsFalseWhenMailIsInvalid() { $mockResponses = new SendMailResponsesTransfer(); $mockResponse = new SendMailResponseTransfer(); $mockResponse->setEmail('*****@*****.**'); $mockResponse->setIsInvalid(true); $mockResponse->setRejectReason(''); $mockResponse->setIdMessage('messageId1'); $mockResponses->addResponse($mockResponse); $result = $this->mailSender->isMailSent($mockResponses); $this->assertFalse($result); }