You are here

public function MailchimpListsTestCase::testGetMergevars in Mailchimp 7.3

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

Tests retrieval of mergevars for a set of lists.

File

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

Class

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

Code

public function testGetMergevars() {
  $list_ids = array(
    MAILCHIMP_LISTS_TEST_LIST_A,
  );
  $lists = mailchimp_get_mergevars($list_ids);
  $this
    ->assertTrue(is_array($lists), 'Tested valid lists array returned.');
  $this
    ->assertTrue(!empty($lists), 'Tested valid lists returned.');
  foreach ($lists as $list) {
    $this
      ->assertTrue(in_array($list['id'], $list_ids), 'Tested valid list ID retrieved: ' . $list['id']);
    $this
      ->assertTrue(is_array($list['merge_vars']), 'Tested list contains merge vars array.');
    foreach ($list['merge_vars'] as $merge_var) {
      $this
        ->assertTrue(isset($merge_var['name']), 'Tested valid merge var.');
    }
  }
}