You are here

public function MailchimpCampaignsTest::testSetCampaignContent in Mailchimp 8

Tests library functionality for setting campaign content.

File

lib/mailchimp-api-php/tests/MailchimpCampaignsTest.php, line 84

Class

MailchimpCampaignsTest
Mailchimp Campaign test library.

Namespace

Mailchimp\Tests

Code

public function testSetCampaignContent() {
  $campaign_id = '42694e9e57';
  $parameters = [
    'html' => '<p>The HTML to use for the saved campaign.</p>',
  ];
  $mc = new MailchimpCampaigns();
  $mc
    ->setCampaignContent($campaign_id, $parameters);
  $this
    ->assertEquals('PUT', $mc
    ->getClient()->method);
  $this
    ->assertEquals($mc
    ->getEndpoint() . '/campaigns/' . $campaign_id . '/content', $mc
    ->getClient()->uri);
  $this
    ->assertNotEmpty($mc
    ->getClient()->options['json']);
  $request_body = $mc
    ->getClient()->options['json'];
  $this
    ->assertEquals($parameters['html'], $request_body->html);
}