You are here

public function MailchimpListsTest::testAddMergeField in Mailchimp 8

Tests library functionality for adding a merge field.

File

lib/mailchimp-api-php/tests/MailchimpListsTest.php, line 81

Class

MailchimpListsTest
Mailchimp Lists test library.

Namespace

Mailchimp\Tests

Code

public function testAddMergeField() {
  $list_id = '57afe96172';
  $name = 'Phone number';
  $type = 'phone';
  $mc = new MailchimpLists();
  $mc
    ->addMergeField($list_id, $name, $type);
  $this
    ->assertEquals('POST', $mc
    ->getClient()->method);
  $this
    ->assertEquals($mc
    ->getEndpoint() . '/lists/' . $list_id . '/merge-fields', $mc
    ->getClient()->uri);
  $request_body = $mc
    ->getClient()->options['json'];
  $this
    ->assertEquals($name, $request_body->name);
  $this
    ->assertEquals($type, $request_body->type);
}