public function MailchimpListsTestCase::testSubscribe in Mailchimp 7.4
Same name and namespace in other branches
- 7.5 modules/mailchimp_lists/tests/mailchimp_lists.test \MailchimpListsTestCase::testSubscribe()
- 7.3 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 135 - 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 = '57afe96172';
$email = 'test@example.org';
$interest_category_id = 'a1e9f4b7f6';
$interest_ids = array(
'9143cf3bd1',
'3a2a927344',
);
$merge_vars = array(
'EMAIL' => $email,
);
$interests = array();
$interests[$interest_category_id] = array(
$interest_ids[0] => 1,
$interest_ids[1] => 0,
);
$member_info = mailchimp_subscribe($list_id, $email, $merge_vars, $interests);
$this
->assertEqual($member_info->id, md5($email), 'Tested new user subscription.');
$this
->assertEqual($member_info->merge_fields->EMAIL, $email);
$this
->assertEqual($member_info->interests->{$interest_category_id}[$interest_ids[0]], TRUE);
$this
->assertEqual($member_info->interests->{$interest_category_id}[$interest_ids[1]], FALSE);
}