Merge pull request #19 from travelton/messageids

BatchMessage Improvements
This commit is contained in:
Travis Swientek 2013-10-16 13:39:57 -07:00
commit 82d17b5b6f
2 changed files with 14 additions and 1 deletions

View File

@ -84,12 +84,15 @@ class BatchMessage extends MessageBuilder{
$this->counters['recipients']['bcc'] = 0;
unset($this->message["to"]);
array_push($this->messageIds, $response->http_response_body->id);
return $this->messageIds;
}
}
public function finalize(){
return $this->sendMessage();
}
public function getMessageIds(){
return $this->messageIds;
}
}
?>

View File

@ -105,6 +105,16 @@ class BatchMessageTest extends \Mailgun\Tests\MailgunTestCase{
$propertyValue = $property->getValue($message);
$this->assertEquals(1, $propertyValue['test-user@samples.mailgun.org']['id']);
}
public function testgetMessageIds() {
$message = $this->client->BatchMessage($this->sampleDomain);
$message->addToRecipient("test-user@samples.mailgun.org", array("first" => "Test", "last" => "User"));
$message->setFromAddress("samples@mailgun.org", array("first" => "Test", "last" => "User"));
$message->setSubject("This is the subject of the message!");
$message->setTextBody("This is the text body of the message!");
$message->finalize();
$this->assertEquals(array("1234"), $message->getMessageIds());
}
}
?>