You are here

public function MailchimpListsBasicTestCase::setUp in Mailchimp 7.2

Pre-test setup function.

Enables dependencies, sets the mailchimp_api_key to the test-mode key, and sets up the 3 mailchimp_lists entities used in our tests:

anonymous_test_list entity attaches to the Mailchimp List test_list_A

optional_test_list entity attaches to the Mailchimp List test_list_B

required_test_list entity attaches to the Mailchimp List test_list_C

Overrides DrupalWebTestCase::setUp

File

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

Class

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

Code

public function setUp() {

  // Use a profile that contains required modules:
  $prof = drupal_get_profile();
  $this->profile = $prof;

  // Enable modules required for the test.
  $enabled_modules = array(
    'libraries',
    'mailchimp',
    'entity',
    'entity_token',
    'mailchimp_lists',
  );
  parent::setUp($enabled_modules);
  variable_set('mailchimp_api_classname', 'MailChimpTest');

  // Create some users with different roles/permissions:
  $this->authorized_user = $this
    ->drupalCreateUser(array());

  // Create some lists:
  $lists = $this
    ->testLists();
  foreach ($lists as $list) {
    mailchimp_lists_save($list);
  }
}