public function MailchimpCampaignsTest::testUpdateCampaign in Mailchimp 8
Tests library functionality for updating a campaign.
File
- lib/
mailchimp-api-php/ tests/ MailchimpCampaignsTest.php, line 119
Class
- MailchimpCampaignsTest
- Mailchimp Campaign test library.
Namespace
Mailchimp\TestsCode
public function testUpdateCampaign() {
$campaign_id = '3e06f4ec92';
$type = 'regular';
$recipients = (object) [
'list_id' => '3c307a9f3f',
];
$settings = (object) [
'subject_line' => 'This is an updated subject line',
'from_name' => 'Customer Service',
];
$mc = new MailchimpCampaigns();
$mc
->updateCampaign($campaign_id, $type, $recipients, $settings);
$this
->assertEquals('PATCH', $mc
->getClient()->method);
$this
->assertEquals($mc
->getEndpoint() . '/campaigns/' . $campaign_id, $mc
->getClient()->uri);
$this
->assertNotEmpty($mc
->getClient()->options['json']);
$request_body = $mc
->getClient()->options['json'];
$this
->assertEquals($type, $request_body->type);
$this
->assertEquals($recipients->list_id, $request_body->recipients->list_id);
$this
->assertEquals($settings->subject_line, $request_body->settings->subject_line);
$this
->assertEquals($settings->from_name, $request_body->settings->from_name);
}