Ejemplo n.º 1
0
 function testMailchimpWebhooks()
 {
     $time = time();
     if ($this->api_key) {
         // A valid 200 OK for an external server (don't rely on true API URL in case of localhost):
         $webhook_test_url = 'http://cashmusic.org/';
         $mc = new MailchimpSeed($this->cash_user_id, $this->mailchimp_connection_id);
         $webhooks1 = $mc->listWebhooks();
         $this->assertTrue(count($webhooks1) == 0, 'zero webhooks initially');
         $rc = $mc->listWebhookAdd($webhook_test_url);
         $this->assertTrue($rc);
         $webhooks2 = $mc->listWebhooks();
         $this->assertIsa($webhooks2, 'Array');
         $this->assertTrue($webhooks2);
         $this->assertTrue(count($webhooks2) == 1, 'added a single webhook');
         $this->assertTrue($webhooks2[0]);
         $this->assertTrue($webhooks2[0]['url']);
         $this->assertEqual($webhook_test_url, $webhooks2[0]['url'], 'url matches our sent url');
         $rc = $mc->listWebhookDel($webhook_test_url);
         $this->assertTrue($rc);
         $webhooks3 = $mc->listWebhooks();
         $this->assertEqual($webhooks1, $webhooks3, 'webhooks get deleted properly');
     } else {
         fwrite(STDERR, "Mailchimp api key not found, skipping mailchimp tests\n");
         return;
     }
 }
Ejemplo n.º 2
0
 function testMailchimpWebhooks()
 {
     $time = time();
     // only run if key / list have been set properly
     if ($this->api_key && $this->api_list_id) {
         // A valid 200 OK for an external server (don't rely on true API URL in case of localhost):
         $webhook_test_url = 'http://cashmusic.org/';
         $mc = new MailchimpSeed($this->cash_user_id, $this->mailchimp_connection_id);
         $webhooks1 = $mc->listWebhooks();
         $initial_webhooks = count($webhooks1);
         //$this->assertTrue(count($webhooks1) == 0, 'zero webhooks initially');
         $rc = $mc->listWebhookAdd($webhook_test_url);
         $this->assertTrue($rc);
         $webhooks2 = $mc->listWebhooks();
         $this->assertIsa($webhooks2, 'Array');
         $this->assertTrue($webhooks2);
         $this->assertTrue(count($webhooks2) == $initial_webhooks + 1, 'incorrect webhook count');
         $this->assertTrue($webhooks2[$initial_webhooks]);
         // using $initial_webhooks as index — zero if none, course corrects to our "new" webhook
         $this->assertTrue($webhooks2[$initial_webhooks]['url']);
         $this->assertEqual($webhook_test_url, $webhooks2[$initial_webhooks]['url'], 'urls do not match');
         $rc = $mc->listWebhookDel($webhook_test_url);
         $this->assertTrue($rc);
         $webhooks3 = $mc->listWebhooks();
         $this->assertEqual($webhooks1, $webhooks3, 'webhooks get deleted properly');
     }
 }
Ejemplo n.º 3
0
 function testMailchimpWebhooks()
 {
     $time = time();
     // only run if key / list have been set properly
     if ($this->api_key && $this->api_list_id) {
         // A valid 200 OK for an external server (don't rely on true API URL in case of localhost):
         $webhook_test_url = 'http://cashmusic.org/';
         $mc = new MailchimpSeed($this->cash_user_id, $this->mailchimp_connection_id);
         $webhooks1 = $mc->listWebhooks();
         $this->assertTrue(count($webhooks1) == 0, 'zero webhooks initially');
         $rc = $mc->listWebhookAdd($webhook_test_url);
         $this->assertTrue($rc);
         $webhooks2 = $mc->listWebhooks();
         $this->assertIsa($webhooks2, 'Array');
         $this->assertTrue($webhooks2);
         $this->assertTrue(count($webhooks2) == 1, 'added a single webhook');
         $this->assertTrue($webhooks2[0]);
         $this->assertTrue($webhooks2[0]['url']);
         $this->assertEqual($webhook_test_url, $webhooks2[0]['url'], 'url matches our sent url');
         $rc = $mc->listWebhookDel($webhook_test_url);
         $this->assertTrue($rc);
         $webhooks3 = $mc->listWebhooks();
         $this->assertEqual($webhooks1, $webhooks3, 'webhooks get deleted properly');
     }
 }