You are here

public function MailchimpListsTest::testUpdateSegment in Mailchimp 8

Tests library functionality for updating a list segment.

File

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

Class

MailchimpListsTest
Mailchimp Lists test library.

Namespace

Mailchimp\Tests

Code

public function testUpdateSegment() {
  $list_id = '57afe96172';
  $segment_id = '49381';
  $name = 'Updated Test Segment';
  $mc = new MailchimpLists();
  $mc
    ->updateSegment($list_id, $segment_id, $name);
  $this
    ->assertEquals('PATCH', $mc
    ->getClient()->method);
  $this
    ->assertEquals($mc
    ->getEndpoint() . '/lists/' . $list_id . '/segments/' . $segment_id, $mc
    ->getClient()->uri);
  $this
    ->assertNotEmpty($mc
    ->getClient()->options['json']);
  $request_body = $mc
    ->getClient()->options['json'];
  $this
    ->assertEquals($name, $request_body->name);
}