You are here

protected function MailchimpListsBasicTestCase::confirmSubscriptionStatus in Mailchimp 7.2

An assertion wrapper for the common task of check a subscription status.

@boolean $expected_outcome Whether we expect the email to be subscribed to the list or not. @string $email Email address to check the status of. @string $mc_list_id ID of the mc list to check against (test_list_X where X = A, B or C) @string $category Populates the column category on the test output page for this assertion. @string $details Text to drop into the output message to distinguish this test.

1 call to MailchimpListsBasicTestCase::confirmSubscriptionStatus()
MailchimpListsBasicTestCase::testMailchimpListSubscriptionWorkflow in modules/mailchimp_lists/tests/mailchimp_lists.test
Tests subscription workflows.

File

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

Class

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

Code

protected function confirmSubscriptionStatus($expected_outcome, $email, $mc_list_id, $category, $details = '') {
  $result = mailchimp_is_subscribed($mc_list_id, $email, TRUE);
  $message = $result === $expected_outcome ? ": confirmed." : ": FAILED.";
  $method = $expected_outcome ? "assertTrue" : "assertFalse";
  $outcome = $expected_outcome ? " subscribed" : " NOT subscribed";
  $this
    ->{$method}($result, $email . $outcome . $details . $message, $category);
}