You are here

public function MailchimpListsTestCase::testDeleteWebhook in Mailchimp 7.3

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

Tests deletion of a webhook.

File

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

Class

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

Code

public function testDeleteWebhook() {
  $list_id = MAILCHIMP_LISTS_TEST_LIST_A;
  $url = 'http://example.org/web-hook-new';
  $actions = array();
  $sources = array();
  mailchimp_webhook_add($list_id, $url, $actions, $sources);
  $webhook_deleted = mailchimp_webhook_delete($list_id, $url);
  $this
    ->assertTrue($webhook_deleted, 'Tested webhook deletion.');
  $found_webhook = FALSE;
  $webhooks = mailchimp_webhook_get($list_id);
  foreach ($webhooks as $webhook) {
    if ($webhook['url'] == $url) {
      $found_webhook = TRUE;
    }
  }
  $this
    ->assertFalse($found_webhook, 'Tested removal of webhook.');
}