예제 #1
0
 public function testSetGet()
 {
     $message = new Message();
     $this->assertEmpty($message->getCharset());
     $subject = 'Test Subject';
     $message->setSubject($subject);
     $this->assertEquals($subject, $message->getSubject(), 'Unable to set subject!');
     $from = '*****@*****.**';
     $message->setFrom($from);
     $this->assertContains($from, $message->getFrom(), 'Unable to set from!');
     $replyTo = '*****@*****.**';
     $message->setReplyTo($replyTo);
     $this->assertContains($replyTo, $message->getReplyTo(), 'Unable to set replyTo!');
     $to = '*****@*****.**';
     $message->setTo($to);
     $this->assertContains($to, $message->getTo(), 'Unable to set to!');
     $cc = '*****@*****.**';
     $message->setCc($cc);
     $this->assertContains($cc, $message->getCc(), 'Unable to set cc!');
     $bcc = '*****@*****.**';
     $message->setBcc($bcc);
     $this->assertContains($bcc, $message->getBcc(), 'Unable to set bcc!');
     $text = 'Text email';
     $message->setTextBody($text);
     $html = '<a>Html email</a>';
     $message->setHtmlBody($html);
     $template = 'template-id';
     $message->setTemplateId($template);
     $this->assertEquals($template, $message->getTemplateId());
     $campaign = 'campaign-id';
     $message->setCampaign($campaign);
     $this->assertEquals($campaign, $message->getCampaign());
     $description = 'description';
     $message->setDescription($description);
     $this->assertEquals($description, $message->getDescription());
     $metadata = ['key' => 'value', 'key1' => 'value1'];
     $message->setMetadata($metadata);
     $this->assertEquals($metadata, $message->getMetadata());
 }