You are here

public function MailchimpAutomationsTest::testAddWorkflowEmailSubscriber in Mailchimp 8

Tests library functionality for a user in a workflow automation queue.

File

lib/mailchimp-api-php/tests/MailchimpAutomationsTest.php, line 92

Class

MailchimpAutomationsTest

Namespace

Mailchimp\Tests

Code

public function testAddWorkflowEmailSubscriber() {
  $workflow_id = '57afe96172';
  $workflow_email_id = 'a87de7d1e5';
  $email = 'test@example.com';
  $mc = new MailchimpAutomations();
  $mc
    ->addWorkflowEmailSubscriber($workflow_id, $workflow_email_id, $email);
  $this
    ->assertEquals('POST', $mc
    ->getClient()->method);
  $this
    ->assertEquals($mc
    ->getEndpoint() . '/automations/' . $workflow_id . '/emails/' . $workflow_email_id . '/queue', $mc
    ->getClient()->uri);
  $this
    ->assertNotEmpty($mc
    ->getClient()->options['json']);
  $request_body = $mc
    ->getClient()->options['json'];
  $this
    ->assertEquals($email, $request_body->email_address);
}