/**
  * Constructor.
  *
  * @param MailInterface $mail The mail
  * @param string|null   $file The file name
  */
 public function __construct(MailInterface $mail, $file = null)
 {
     parent::__construct($mail);
     $this->setFile($file);
     $this->subject = 'subject';
     $this->htmlBody = 'html_body';
     $this->body = 'body';
 }
 public function testModel()
 {
     /* @var MailInterface $mail */
     $mail = $this->getMockBuilder(MailInterface::class)->getMock();
     $translation = new MailTranslation($mail);
     $translation->setSubject('Subject of translation')->setHtmlBody('HTML body of translation')->setLocale('fr')->setLabel('Label of translation')->setDescription('Description of translation')->setBody('Body of translation');
     $this->assertSame($mail, $translation->getMail());
     $this->assertSame('fr', $translation->getLocale());
     $this->assertSame('Label of translation', $translation->getLabel());
     $this->assertSame('Description of translation', $translation->getDescription());
     $this->assertSame('Subject of translation', $translation->getSubject());
     $this->assertSame('HTML body of translation', $translation->getHtmlBody());
     $this->assertSame('Body of translation', $translation->getBody());
 }
 /**
  * Create the mail.
  *
  * @param bool $withLayout
  * @param bool $withTranslation
  * @param bool $withTranslationDomain
  *
  * @return Mail
  */
 protected function createMail($withLayout = false, $withTranslation = false, $withTranslationDomain = false)
 {
     $mail = new Mail();
     $mail->setType(MailTypes::TYPE_ALL)->setSubject('Subject of template')->setHtmlBody('HTML Body of template')->setBody('Body of template')->setName('test')->setLabel('Test')->setDescription('Description of template')->setEnabled(true)->setTranslationDomain($withTranslationDomain ? 'domain' : null);
     if ($withLayout) {
         $mail->setLayout($this->createLayout($withTranslation, $withTranslationDomain));
     }
     if ($withTranslation && !$withTranslationDomain) {
         $translation = new MailTranslation($mail);
         $translation->setSubject('Subject of translation')->setHtmlBody('HTML body of translation')->setLocale('fr')->setLabel('Label of translation')->setDescription('Description of translation')->setBody('Body of translation');
     }
     return $mail;
 }
 /**
  * Get the mail and translation models.
  *
  * @param string $locale The locale
  *
  * @return array The mail and translation
  */
 protected function getModels($locale)
 {
     $mail = new Mail();
     $mail->setName('test')->setLabel('Label of template')->setDescription('Description of template')->setSubject('Subject of template')->setHtmlBody('HTML Body of template')->setBody('Body of template');
     $translation = new MailTranslation($mail);
     $translation->setSubject('Subject of translated template')->setHtmlBody('HTML Body of translated template')->setSubject('Subject of template')->setHtmlBody('HTML Body of template')->setLocale($locale)->setLabel('Label of translated template')->setDescription('Description of translated template')->setBody('Body of translated template');
     return array($mail, $translation);
 }