mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2025-02-06 08:19:25 +03:00
Cast campaign ID-s to string (#460)
* 413 error proper handle. * Cast campaign id-s to string. Added tests for that. * Style fixes
This commit is contained in:
parent
0bd1d8bfc5
commit
83c5f76f87
@ -368,9 +368,9 @@ class MessageBuilder
|
||||
{
|
||||
if ($this->counters['attributes']['campaign_id'] < Api::CAMPAIGN_ID_LIMIT) {
|
||||
if (isset($this->message['o:campaign'])) {
|
||||
array_push($this->message['o:campaign'], $campaignId);
|
||||
array_push($this->message['o:campaign'], (string) $campaignId);
|
||||
} else {
|
||||
$this->message['o:campaign'] = [$campaignId];
|
||||
$this->message['o:campaign'] = [(string) $campaignId];
|
||||
}
|
||||
$this->counters['attributes']['campaign_id'] += 1;
|
||||
|
||||
|
@ -245,7 +245,7 @@ class MessageBuilderTest extends \Mailgun\Tests\MailgunTestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testsetTestMode()
|
||||
public function testSetTestMode()
|
||||
{
|
||||
$message = $this->client->MessageBuilder();
|
||||
$message->setTestMode(true);
|
||||
@ -262,17 +262,25 @@ class MessageBuilderTest extends \Mailgun\Tests\MailgunTestCase
|
||||
$this->assertEquals(['o:testmode' => 'no'], $messageObj);
|
||||
}
|
||||
|
||||
public function addCampaignId()
|
||||
public function testAddCampaignId()
|
||||
{
|
||||
$message = $this->client->MessageBuilder();
|
||||
$message->addCampaignId('ABC123');
|
||||
$message->addCampaignId('XYZ987');
|
||||
$message->addCampaignId('TUV456');
|
||||
$message->addCampaignId('NONO123');
|
||||
$messageObj = $message->getMessage();
|
||||
$this->assertEquals(['o:campaign' => ['ABC123', 'XYZ987', 'TUV456']], $messageObj);
|
||||
}
|
||||
|
||||
public function testAddCampaignIdInteger()
|
||||
{
|
||||
$message = $this->client->MessageBuilder();
|
||||
$message->addCampaignId(1111);
|
||||
$message->addCampaignId(2222);
|
||||
$messageObj = $message->getMessage();
|
||||
$this->assertSame(['o:campaign' => ['1111', '2222']], $messageObj);
|
||||
}
|
||||
|
||||
public function testSetDkim()
|
||||
{
|
||||
$message = $this->client->MessageBuilder();
|
||||
|
Loading…
x
Reference in New Issue
Block a user