You are here

public function MailchimpListsWebhookTest::testAddWebhook in Mailchimp 2.x

Same name and namespace in other branches
  1. 8 modules/mailchimp_lists/src/Tests/MailchimpListsWebhookTest.php \Drupal\Tests\mailchimp_lists\Functional\MailchimpListsWebhookTest::testAddWebhook()

Tests adding a webhook to a list.

File

modules/mailchimp_lists/tests/src/Functional/MailchimpListsWebhookTest.php, line 39

Class

MailchimpListsWebhookTest
Tests list webhook functionality.

Namespace

Drupal\Tests\mailchimp_lists\Functional

Code

public function testAddWebhook() {
  $list_id = '57afe96172';
  $url = 'http://example.org/web-hook-new';
  $events = [
    'subscribe' => TRUE,
  ];
  $sources = [
    'user' => TRUE,
    'admin' => TRUE,
    'api' => FALSE,
  ];
  $webhook_id = mailchimp_webhook_add($list_id, $url, $events, $sources);
  $this
    ->assertSame($webhook_id, 'ab24521a00');
}