mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-29 16:36:07 +03:00
Merge pull request #16 from travelton/BatchMessageFixing
Fixed missing IDs for batch message recipients. Closes #15.
This commit is contained in:
commit
70cd750ace
@ -36,7 +36,9 @@ class BatchMessage extends MessageBuilder{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->addRecipient("to", $address, $variables);
|
$this->addRecipient("to", $address, $variables);
|
||||||
$attributes["id"] = $this->toRecipientCount;
|
if(!array_key_exists("id", $variables)){
|
||||||
|
$variables['id'] = $this->toRecipientCount;
|
||||||
|
}
|
||||||
$this->batchRecipientAttributes["$address"] = $variables;
|
$this->batchRecipientAttributes["$address"] = $variables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +59,16 @@ class BatchMessageTest extends \Mailgun\Tests\MailgunTestCase{
|
|||||||
$property->setAccessible(true);
|
$property->setAccessible(true);
|
||||||
$this->assertEquals(1, $property->getValue($message));
|
$this->assertEquals(1, $property->getValue($message));
|
||||||
}
|
}
|
||||||
|
public function testDefaultIDInVariables() {
|
||||||
|
$message = $this->client->BatchMessage($this->sampleDomain);
|
||||||
|
$message->addToRecipient("test-user@samples.mailgun.org", array("first" => "Test", "last" => "User"));
|
||||||
|
|
||||||
|
$reflectionClass = new \ReflectionClass(get_class($message));
|
||||||
|
$property = $reflectionClass->getProperty('batchRecipientAttributes');
|
||||||
|
$property->setAccessible(True);
|
||||||
|
$propertyValue = $property->getValue($message);
|
||||||
|
$this->assertEquals(1, $propertyValue['test-user@samples.mailgun.org']['id']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user