/**
  * Create fixture in CiviCRM.
  */
 public function setUp()
 {
     if (static::$fixture_should_be_reset) {
         static::createCiviCrmFixtures();
     }
     static::$fixture_should_be_reset = TRUE;
 }
 /**
  * Test the webhook configured incorrectly.
  *
  * @expectedException RuntimeException
  * @expectedExceptionMessageRegExp /The list 'dummylistid' is not configured correctly at Mailchimp/
  */
 public function testWebhookWrongConfig()
 {
     // We do not change anything on the fixture.
     static::$fixture_should_be_reset = FALSE;
     // Make mock API that will return a webhook with the sources.API setting
     // set, which is wrong.
     $api_prophecy = $this->prophesize('CRM_Mailchimp_Api3');
     CRM_Mailchimp_Utils::setMailchimpApi($api_prophecy->reveal());
     $url = CRM_Mailchimp_Utils::getWebhookUrl();
     $api_prophecy->get("/lists/dummylistid/webhooks", Argument::any())->shouldBeCalled()->willReturn(json_decode('{"http_code":200,"data":{"webhooks":[{"url":"' . $url . '","sources":{"api":true}}]}}'));
     $w = new CRM_Mailchimp_Page_WebHook();
     list($code, $response) = $w->processRequest('a', 'a', ['type' => 'subscribe', 'data' => ['list_id' => 'dummylistid']]);
 }