static function forceCiviToMailchimpSync($mailchimp_sync_setting)
 {
     $contacts = CRM_CiviMailchimp_Utils::getActiveGroupMembers($mailchimp_sync_setting->civicrm_group_id);
     $skipped_contacts = 0;
     foreach ($contacts as $key => $contact_id) {
         $contact = CRM_CiviMailchimp_Utils::getContactById($contact_id);
         if ($contact->is_deleted != 1) {
             $email = CRM_CiviMailchimp_Utils::determineMailchimpEmailForContact($contact);
             if ($email === NULL) {
                 ++$skipped_contacts;
                 unset($contacts[$key]);
             } else {
                 $merge_fields = CRM_CiviMailchimp_Utils::getMailchimpMergeFields($mailchimp_sync_setting->mailchimp_list_id);
                 $merge_vars = CRM_CiviMailchimp_Utils::formatMailchimpMergeVars($merge_fields, $contact);
                 CRM_CiviMailchimp_Utils::subscribeContactToMailchimpList($mailchimp_sync_setting->mailchimp_list_id, $email, $merge_vars);
             }
         }
     }
     if ($skipped_contacts > 0) {
         $message = ts('%1 records were not synced to Mailchimp because they did not have a valid email address.', array(1 => $skipped_contacts));
         CRM_CiviMailchimp_BAO_SyncLog::saveMessage('error', 'civicrm_to_mailchimp', $message);
     }
     return $contacts;
 }
 function testGetActiveGroupMembersEmptyGroup()
 {
     $params = CRM_CiviMailchimp_UtilsTest::sampleContactParams();
     $contact = CRM_Contact_BAO_Contact::create($params);
     $mailchimp_sync_setting = CRM_CiviMailchimp_BAO_SyncSettingsTest::createTestGroupAndSyncSettings('Test group testGetActiveGroupMembersEmptyGroup');
     $group_contact_ids = CRM_CiviMailchimp_Utils::getActiveGroupMembers($mailchimp_sync_setting->civicrm_group_id);
     $this->assertEmpty($group_contact_ids);
 }