public function testGetEmailBody() { $emailEntity = new Email(); $templatePath = 'template_path'; $body = 'body'; $this->emailCacheManager->expects($this->once())->method('ensureEmailBodyCached')->with($emailEntity); $this->templating->expects($this->once())->method('render')->with($templatePath, ['email' => $emailEntity])->willReturn($body); $result = $this->helper->getEmailBody($emailEntity, $templatePath); $this->assertEquals($body, $result); }
/** * @param EmailEntity $parentEmailEntity * * @return EmailModel */ public function createForwardEmailModel(EmailEntity $parentEmailEntity) { $emailModel = $this->factory->getEmail(); $emailModel->setMailType(EmailModel::MAIL_TYPE_FORWARD); $emailModel->setParentEmailId($parentEmailEntity->getId()); $emailModel->setSubject($this->helper->prependWith('Fwd: ', $parentEmailEntity->getSubject())); $body = $this->helper->getEmailBody($parentEmailEntity, 'OroEmailBundle:Email/Forward:parentBody.html.twig'); $emailModel->setBodyFooter($body); // link attachments of forwarded email to current email instance if ($this->request->isMethod('GET')) { $this->applyAttachments($emailModel, $parentEmailEntity); } return $this->createEmailModel($emailModel); }