You are here

public function MailchimpListsTestCase::testSubscribe in Mailchimp 7.3

Same name and namespace in other branches
  1. 7.5 modules/mailchimp_lists/tests/mailchimp_lists.test \MailchimpListsTestCase::testSubscribe()
  2. 7.4 modules/mailchimp_lists/tests/mailchimp_lists.test \MailchimpListsTestCase::testSubscribe()

Tests subscribing a member to a list.

File

modules/mailchimp_lists/tests/mailchimp_lists.test, line 153
Test class and methods for the Mailchimp Lists module.

Class

MailchimpListsTestCase
@file Test class and methods for the Mailchimp Lists module.

Code

public function testSubscribe() {
  $list_id = MAILCHIMP_LISTS_TEST_LIST_A;
  $email = 'user@example.org';
  $subscribed = mailchimp_subscribe($list_id, $email);
  $this
    ->assertTrue($subscribed, 'Tested new user subscription.');
  $list_id = MAILCHIMP_LISTS_TEST_LIST_INVALID;
  $subscribed = mailchimp_subscribe($list_id, $email);
  $this
    ->assertFalse($subscribed, 'Tested new user subscription to invalid list.');
}