Ejemplo n.º 1
0
 public function testSucceedWithOptionsArray()
 {
     $headers = array('in-reply-to' => 'data', 'list-id' => 'data2', 'references' => 'data3');
     $attachments = array('test.gif' => 'data', 't.jpg' => 'data2', 'z.png' => 'data3');
     $options = array('sender' => '*****@*****.**', 'replyto' => '*****@*****.**', 'to' => array('*****@*****.**', '*****@*****.**'), 'cc' => array('*****@*****.**', '*****@*****.**'), 'bcc' => array('*****@*****.**', '*****@*****.**'), 'subject' => 'test', 'textBody' => 'text body', 'htmlBody' => 'html body', 'header' => $headers, 'attachment' => $attachments);
     $message = new Message($options);
     $message_proto = new MailMessage();
     $message_proto->setSender("*****@*****.**");
     $message_proto->setReplyto("*****@*****.**");
     $message_proto->addTo("*****@*****.**");
     $message_proto->addTo("*****@*****.**");
     $message_proto->addCc("*****@*****.**");
     $message_proto->addCc("*****@*****.**");
     $message_proto->addBcc("*****@*****.**");
     $message_proto->addBcc("*****@*****.**");
     $message_proto->setSubject("test");
     $message_proto->setTextbody("text body");
     $message_proto->setHtmlbody("html body");
     $header = $message_proto->addHeader();
     $header->setName("in-reply-to");
     $header->setValue("data");
     $header = $message_proto->addHeader();
     $header->setName("list-id");
     $header->setValue("data2");
     $header = $message_proto->addHeader();
     $header->setName("references");
     $header->setValue("data3");
     $attach = $message_proto->addAttachment();
     $attach->setFilename("test.gif");
     $attach->setData("data");
     $attach = $message_proto->addAttachment();
     $attach->setFilename("t.jpg");
     $attach->setData("data2");
     $attach = $message_proto->addAttachment();
     $attach->setFilename("z.png");
     $attach->setData("data3");
     $response = new VoidProto();
     $this->apiProxyMock->expectCall('mail', 'Send', $message_proto, $response);
     $message->send();
     $this->apiProxyMock->verify();
 }
 private function setUpAttachmentMessageProto()
 {
     $message_proto = new MailMessage();
     $message_proto->setSender("*****@*****.**");
     $message_proto->setReplyto("*****@*****.**");
     $message_proto->setSubject("test");
     $message_proto->setTextbody("text body");
     $message_proto->setHtmlbody("html body");
     $header = $message_proto->addHeader();
     $header->setName("in-reply-to");
     $header->setValue("data");
     $header = $message_proto->addHeader();
     $header->setName("list-id");
     $header->setValue("data2");
     $header = $message_proto->addHeader();
     $header->setName("references");
     $header->setValue("data3");
     $attach = $message_proto->addAttachment();
     $attach->setFilename("test.gif");
     $attach->setData("data");
     $attach = $message_proto->addAttachment();
     $attach->setFilename("t.jpg");
     $attach->setData("data2");
     $attach = $message_proto->addAttachment();
     $attach->setFilename("z.png");
     $attach->setData("data3");
     return $message_proto;
 }