mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-23 04:56:02 +03:00
Fixed missing IDs for batch message recipients. Closes #15.
This commit is contained in:
parent
75ffd38b1d
commit
fc9685182b
@ -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