function testRemoveContactFromGroupMarkedAsNoBulkEmails()
 {
     $no_bulk_emails_on_unsubscribe = CRM_Core_BAO_Setting::setItem(1, 'CiviMailchimp Preferences', 'mailchimp_no_bulk_emails_on_unsubscribe');
     $params = CRM_CiviMailchimp_UtilsTest::sampleContactParams();
     $contact = CRM_Contact_BAO_Contact::create($params);
     $mailchimp_sync_setting = CRM_CiviMailchimp_BAO_SyncSettingsTest::createTestGroupAndSyncSettings('Test group testRemoveContactFromGroupMarkedAsNoBulkEmails');
     // Test that the contact is in the group
     $contact_ids = array($contact->id);
     CRM_Contact_BAO_GroupContact::addContactsToGroup($contact_ids, $mailchimp_sync_setting->civicrm_group_id);
     $contact_added_to_group = CRM_Contact_BAO_GroupContact::isContactInGroup($contact->id, $mailchimp_sync_setting->civicrm_group_id);
     $this->assertTrue($contact_added_to_group);
     // Test that the contact is removed from the group
     CRM_CiviMailchimp_Utils::removeContactFromGroup($contact, $mailchimp_sync_setting->mailchimp_list_id);
     $contact_added_to_group = CRM_Contact_BAO_GroupContact::isContactInGroup($contact->id, $mailchimp_sync_setting->civicrm_group_id);
     $this->assertFalse($contact_added_to_group);
     // Test that contact is marked as No Bulk Emails
     $updated_contact = CRM_CiviMailchimp_Utils::getContactById($contact->id);
     $this->assertEquals(1, $updated_contact->is_opt_out);
 }
 /**
  * Remove a Mailchimp subscriber from a CiviCRM Group.
  */
 static function mailchimpWebhookUnsubscribe($request_data)
 {
     $mailchimp_contact = CRM_CiviMailchimp_Utils::getContactInMailchimpListByEmail($request_data['email'], $request_data['list_id']);
     CRM_CiviMailchimp_Utils::removeContactFromGroup($mailchimp_contact, $request_data['list_id']);
 }