public function testMessageComplete() { $result = $this->_message->setCharset('utf-8')->setTags('tag1')->setTo('*****@*****.**')->setFrom('*****@*****.**')->setReplyTo('*****@*****.**')->setCc('*****@*****.**')->setBcc('*****@*****.**')->setGlobalMergeVars(['var1' => 'value1'])->setSubject(' <a>Testo ')->setTextBody('testo<script>alert("ciao");</script>')->setHtmlBody('<a>testo</a>')->attachContent($this->getTestPdfBinary(), ['fileName' => '12.txt', 'contentType' => 'image/png'])->embed($this->getTestImagePath()); $this->assertInstanceOf('\\nickcv\\mandrill\\Message', $result); $this->assertNull($this->_message->getCharset()); $tags = $this->_message->getTags(); $this->assertCount(1, $tags); $this->assertContains('tag1', $tags); $to = $this->_message->getTo(); $this->assertCount(1, $to); $this->assertContains('*****@*****.**', $to); $this->assertEquals('My Application<*****@*****.**>', $this->_message->getFrom()); $reply = $this->_message->getReplyTo(); $this->assertCount(1, $reply); $this->assertContains('*****@*****.**', $reply); $cc = $this->_message->getCc(); $this->assertCount(1, $cc); $this->assertContains('*****@*****.**', $cc); $bcc = $this->_message->getBcc(); $this->assertCount(1, $bcc); $this->assertContains('*****@*****.**', $bcc); $this->assertEquals([['name' => 'var1', 'content' => 'value1']], $this->_message->getGlobalMergeVars()); $this->assertEquals('<a>Testo', $this->_message->getSubject()); $this->assertEquals('testo', $this->_message->getTextBody()); $this->assertEquals('<a>testo</a>', $this->_message->getHtmlBody()); $attachments = $this->_message->getAttachments(); $this->assertCount(1, $attachments); $this->assertEquals($this->getTestPdfBinary(true), $attachments[0]['content']); $this->assertEquals('12.txt', $attachments[0]['name']); $this->assertEquals('image/png', $attachments[0]['type']); $embeds = $this->_message->getEmbeddedContent(); $this->assertCount(1, $embeds); $this->assertEquals($this->getTestImageBinary(true), $embeds[0]['content']); $this->assertEquals('test.png', $embeds[0]['name']); $this->assertEquals('image/png', $embeds[0]['type']); }