From 9f1b81e0ac968205dc1aa169eea1dc1d243957f8 Mon Sep 17 00:00:00 2001 From: eileen Date: Sat, 3 Aug 2013 19:05:41 +1200 Subject: [PATCH] test tweaks and updated examples --- .../Activity/ContactRefCustomField.php | 8 +- .../Activity/ContactRefCustomFieldGet.php | 30 ++--- api/v3/examples/Activity/DateTimeHigh.php | 4 +- api/v3/examples/Activity/DateTimeLow.php | 2 +- .../Activity/GetTargetandAssignee.php | 6 +- .../Activity/ReturnAssigneeContact.php | 44 ++++---- api/v3/examples/ActivityCreate.php | 2 +- api/v3/examples/ActivityGet.php | 4 +- api/v3/examples/BatchCreate.php | 4 +- api/v3/examples/BatchUpdate.php | 4 +- api/v3/examples/Contact/APIChainedArray.php | 6 +- .../Contact/APIChainedArrayFormats.php | 6 +- .../Contact/APIChainedArrayMultipleCustom.php | 6 +- ...IChainedArrayValuesFromSiblingFunction.php | 2 + api/v3/examples/Contact/ChainTwoWebsites.php | 4 +- .../Contact/ChainTwoWebsitesSyntax2.php | 4 +- api/v3/examples/Contact/GetFieldsOptions.php | 54 +++++---- api/v3/examples/Contact/GetSingleContact.php | 6 +- .../Contact/GroupFilterUsingContactAPI.php | 6 +- api/v3/examples/ContactCreate.php | 2 + api/v3/examples/ContactGet.php | 6 +- .../ContributionCreateWithNote.php | 2 +- .../CreateWithNestedLineItems.php | 2 +- api/v3/examples/ContributionPageCreate.php | 2 +- api/v3/examples/ContributionRecurCreate.php | 4 +- api/v3/examples/ContributionRecurGet.php | 2 +- api/v3/examples/CustomGroupCreate.php | 8 +- api/v3/examples/Email/NestedReplaceEmail.php | 6 +- api/v3/examples/Event/IsFullOption.php | 2 +- api/v3/examples/EventCreate.php | 4 +- api/v3/examples/EventGet.php | 4 +- api/v3/examples/GrantCreate.php | 2 +- api/v3/examples/GrantGet.php | 2 +- .../examples/GroupContact/GetWithGroupID.php | 4 +- api/v3/examples/GroupGet.php | 2 +- api/v3/examples/LocBlockCreateEntities.php | 6 +- api/v3/examples/MailingCreate.php | 4 +- api/v3/examples/MailingGroupSubscribe.php | 12 +- .../examples/Membership/filterIsCurrent.php | 4 +- api/v3/examples/MembershipCreate.php | 4 +- api/v3/examples/MembershipGet.php | 4 +- api/v3/examples/MembershipUpdate.php | 4 +- .../Participant/CreateParticipantPayment.php | 2 + api/v3/examples/Participant/NestedDelete.php | 8 +- .../examples/Participant/NestedEventGet.php | 12 +- api/v3/examples/ParticipantGet.php | 4 +- api/v3/examples/Pledge/GetFilterHighDate.php | 4 +- api/v3/examples/PledgeCreate.php | 10 +- api/v3/examples/PledgeGet.php | 4 +- api/v3/examples/PledgePaymentCreate.php | 2 +- api/v3/examples/ProfileSet.php | 4 +- .../Relationship/BetweenRelationshipType.php | 6 +- .../Relationship/INRelationshipType.php | 4 +- .../NotBetweenRelationshipType.php | 2 +- .../Relationship/NotInRelationshipType.php | 4 +- .../examples/Relationship/filterIsCurrent.php | 2 +- api/v3/examples/RelationshipCreate.php | 4 +- api/v3/examples/RelationshipGet.php | 2 +- api/v3/examples/SurveyCreate.php | 1 + api/v3/examples/TagCreate.php | 2 +- api/v3/examples/TagGet.php | 2 +- api/v3/examples/UFFieldReplace.php | 2 +- api/v3/examples/UFGroupCreate.php | 3 +- api/v3/examples/UFGroupGet.php | 2 +- tests/phpunit/CiviTest/CiviUnitTestCase.php | 23 +++- tests/phpunit/api/v3/ActivityTest.php | 105 +++++------------- tests/phpunit/api/v3/EventTest.php | 4 +- tests/phpunit/api/v3/MailingGroupTest.php | 3 +- 68 files changed, 241 insertions(+), 274 deletions(-) diff --git a/api/v3/examples/Activity/ContactRefCustomField.php b/api/v3/examples/Activity/ContactRefCustomField.php index 812322f37b..b227a6a530 100644 --- a/api/v3/examples/Activity/ContactRefCustomField.php +++ b/api/v3/examples/Activity/ContactRefCustomField.php @@ -1,11 +1,11 @@ 17, + 'source_contact_id' => 1, 'activity_type_id' => '46', 'subject' => 'test activity type id', 'activity_date_time' => '2011-06-02 14:36:13', @@ -14,11 +14,11 @@ $params = array( 'duration' => 120, 'location' => 'Pensulvania', 'details' => 'a test activity', - 'custom_2' => '17', + 'custom_2' => '1', ); try{ - $result = civicrm_api3('activity', 'create', $params); + $result = civicrm_api3('activity', 'Create', $params); } catch (CiviCRM_API3_Exception $e) { // handle error here diff --git a/api/v3/examples/Activity/ContactRefCustomFieldGet.php b/api/v3/examples/Activity/ContactRefCustomFieldGet.php index fb684c6992..25b80b4558 100644 --- a/api/v3/examples/Activity/ContactRefCustomFieldGet.php +++ b/api/v3/examples/Activity/ContactRefCustomFieldGet.php @@ -1,24 +1,16 @@ 17, - 'activity_type_id' => '46', - 'subject' => 'test activity type id', - 'activity_date_time' => '2011-06-02 14:36:13', - 'status_id' => 2, - 'priority_id' => 1, - 'duration' => 120, - 'location' => 'Pensulvania', - 'details' => 'a test activity', - 'custom_2' => '17', + 'return.custom_2' => 1, + 'id' => 1, ); try{ - $result = civicrm_api3('activity', 'create', $params); + $result = civicrm_api3('activity', 'get', $params); } catch (CiviCRM_API3_Exception $e) { // handle error here @@ -34,7 +26,7 @@ return $result; /** * Function returns array of result expected from previous function */ -function activity_create_expectedresult(){ +function activity_get_expectedresult(){ $expectedResult = array( 'is_error' => 0, @@ -56,11 +48,11 @@ function activity_create_expectedresult(){ 'is_auto' => 0, 'is_current_revision' => '1', 'is_deleted' => 0, - 'source_contact_id' => '17', - 'custom_2_id' => '17', - 'custom_2_1_id' => '17', - 'custom_2' => 'Contact, Test', - 'custom_2_1' => 'Contact, Test', + 'source_contact_id' => '1', + 'custom_2_id' => '1', + 'custom_2_1_id' => '1', + 'custom_2' => 'Anderson, Anthony', + 'custom_2_1' => 'Anderson, Anthony', ), ), ); diff --git a/api/v3/examples/Activity/DateTimeHigh.php b/api/v3/examples/Activity/DateTimeHigh.php index e5b1d98402..1242157cef 100644 --- a/api/v3/examples/Activity/DateTimeHigh.php +++ b/api/v3/examples/Activity/DateTimeHigh.php @@ -5,7 +5,7 @@ */ function activity_get_example(){ $params = array( - 'source_contact_id' => 17, + 'source_contact_id' => 1, 'filter.activity_date_time_high' => '20120101000000', 'sequential' => 1, ); @@ -49,7 +49,7 @@ function activity_get_expectedresult(){ 'is_auto' => 0, 'is_current_revision' => '1', 'is_deleted' => 0, - 'source_contact_id' => '17', + 'source_contact_id' => '1', ), ), ); diff --git a/api/v3/examples/Activity/DateTimeLow.php b/api/v3/examples/Activity/DateTimeLow.php index 06112d8e66..d191789f87 100644 --- a/api/v3/examples/Activity/DateTimeLow.php +++ b/api/v3/examples/Activity/DateTimeLow.php @@ -48,7 +48,7 @@ function activity_get_expectedresult(){ 'is_auto' => 0, 'is_current_revision' => '1', 'is_deleted' => 0, - 'source_contact_id' => '17', + 'source_contact_id' => '1', ), ), ); diff --git a/api/v3/examples/Activity/GetTargetandAssignee.php b/api/v3/examples/Activity/GetTargetandAssignee.php index 8b83ea741d..e6b7027e23 100644 --- a/api/v3/examples/Activity/GetTargetandAssignee.php +++ b/api/v3/examples/Activity/GetTargetandAssignee.php @@ -5,7 +5,7 @@ */ function activity__example(){ $params = array( - 'source_contact_id' => 17, + 'source_contact_id' => 1, 'subject' => 'Make-it-Happen Meeting', 'activity_date_time' => '20110316', 'duration' => 120, @@ -14,8 +14,8 @@ $params = array( 'status_id' => 1, 'activity_type_id' => 1, 'priority_id' => 1, - 'target_contact_id' => 17, - 'assignee_contact_id' => 17, + 'target_contact_id' => 1, + 'assignee_contact_id' => 1, ); try{ diff --git a/api/v3/examples/Activity/ReturnAssigneeContact.php b/api/v3/examples/Activity/ReturnAssigneeContact.php index dd5f904239..a9be1fcddc 100644 --- a/api/v3/examples/Activity/ReturnAssigneeContact.php +++ b/api/v3/examples/Activity/ReturnAssigneeContact.php @@ -53,36 +53,36 @@ function activity_get_expectedresult(){ 'is_current_revision' => '1', 'is_deleted' => 0, 'assignee_contact_id' => array( - '0' => '19', + '0' => '3', ), - 'source_contact_id' => '17', + 'source_contact_id' => '1', 'api.contact.get' => array( 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 17, + 'id' => 1, 'values' => array( '0' => array( - 'contact_id' => '17', + 'contact_id' => '1', 'contact_type' => 'Individual', 'contact_sub_type' => '', - 'sort_name' => '', - 'display_name' => 'Test Contact', - 'do_not_email' => '', - 'do_not_phone' => '', - 'do_not_mail' => '', - 'do_not_sms' => '', - 'do_not_trade' => '', + 'sort_name' => 'Anderson, Anthony', + 'display_name' => 'Mr. Anthony Anderson II', + 'do_not_email' => 0, + 'do_not_phone' => 0, + 'do_not_mail' => 0, + 'do_not_sms' => 0, + 'do_not_trade' => 0, 'is_opt_out' => 0, 'legal_identifier' => '', 'external_identifier' => '', 'nick_name' => '', 'legal_name' => '', 'image_URL' => '', - 'preferred_mail_format' => '', - 'first_name' => 'Test', - 'middle_name' => '', - 'last_name' => 'Contact', + 'preferred_mail_format' => 'Both', + 'first_name' => 'Anthony', + 'middle_name' => 'J.', + 'last_name' => 'Anderson', 'job_title' => '', 'birth_date' => '', 'is_deceased' => 0, @@ -102,22 +102,22 @@ function activity_get_expectedresult(){ 'geo_code_1' => '', 'geo_code_2' => '', 'state_province_id' => '', - 'state_province_name' => '', - 'state_province' => '', 'country_id' => '', - 'country' => '', 'phone_id' => '', 'phone_type_id' => '', 'phone' => '', - 'email_id' => '', - 'email' => '', - 'on_hold' => '', + 'email_id' => '1', + 'email' => 'anthony_anderson@civicrm.org', + 'on_hold' => 0, 'im_id' => '', 'provider_id' => '', 'im' => '', 'worldregion_id' => '', 'world_region' => '', - 'id' => '17', + 'state_province_name' => '', + 'state_province' => '', + 'country' => '', + 'id' => '1', ), ), ), diff --git a/api/v3/examples/ActivityCreate.php b/api/v3/examples/ActivityCreate.php index 38c3dd6ca1..bd5f4c1d85 100644 --- a/api/v3/examples/ActivityCreate.php +++ b/api/v3/examples/ActivityCreate.php @@ -5,7 +5,7 @@ */ function activity_create_example(){ $params = array( - 'source_contact_id' => 17, + 'source_contact_id' => 1, 'activity_type_id' => '46', 'subject' => 'test activity type id', 'activity_date_time' => '2011-06-02 14:36:13', diff --git a/api/v3/examples/ActivityGet.php b/api/v3/examples/ActivityGet.php index ca2aec0e30..5b1dd1ac1c 100644 --- a/api/v3/examples/ActivityGet.php +++ b/api/v3/examples/ActivityGet.php @@ -5,7 +5,7 @@ */ function activity_get_example(){ $params = array( - 'contact_id' => 17, + 'contact_id' => 1, 'activity_type_id' => '46', 'sequential' => 1, 'return.custom_1' => 1, @@ -37,7 +37,7 @@ function activity_get_expectedresult(){ 'id' => 1, 'values' => array( '0' => array( - 'source_contact_id' => '17', + 'source_contact_id' => '1', 'id' => '1', 'activity_type_id' => '46', 'subject' => 'test activity type id', diff --git a/api/v3/examples/BatchCreate.php b/api/v3/examples/BatchCreate.php index 7ab643f115..80976d11f8 100644 --- a/api/v3/examples/BatchCreate.php +++ b/api/v3/examples/BatchCreate.php @@ -44,9 +44,9 @@ function batch_create_expectedresult(){ 'title' => 'New Batch 03', 'description' => 'This is description for New Batch 03', 'created_id' => '', - 'created_date' => '2013-07-28 08:49:19', + 'created_date' => '', 'modified_id' => '', - 'modified_date' => '2012-11-14 16:02:35', + 'modified_date' => '', 'saved_search_id' => '', 'status_id' => '1', 'type_id' => '', diff --git a/api/v3/examples/BatchUpdate.php b/api/v3/examples/BatchUpdate.php index ca87f7df19..453aa22521 100644 --- a/api/v3/examples/BatchUpdate.php +++ b/api/v3/examples/BatchUpdate.php @@ -44,9 +44,9 @@ function batch_update_expectedresult(){ 'title' => 'New Batch 04', 'description' => 'This is description for New Batch 04', 'created_id' => '', - 'created_date' => '2013-07-28 08:49:19', + 'created_date' => '', 'modified_id' => '', - 'modified_date' => '2012-11-14 16:02:35', + 'modified_date' => '', 'saved_search_id' => '', 'status_id' => '', 'type_id' => '', diff --git a/api/v3/examples/Contact/APIChainedArray.php b/api/v3/examples/Contact/APIChainedArray.php index 4436fb8d27..539f60bfb2 100644 --- a/api/v3/examples/Contact/APIChainedArray.php +++ b/api/v3/examples/Contact/APIChainedArray.php @@ -79,10 +79,7 @@ function contact_get_expectedresult(){ 'geo_code_1' => '', 'geo_code_2' => '', 'state_province_id' => '', - 'state_province_name' => '', - 'state_province' => '', 'country_id' => '', - 'country' => '', 'phone_id' => '', 'phone_type_id' => '', 'phone' => '', @@ -94,6 +91,9 @@ function contact_get_expectedresult(){ 'im' => '', 'worldregion_id' => '', 'world_region' => '', + 'state_province_name' => '', + 'state_province' => '', + 'country' => '', 'id' => '1', 'api.website.get' => array( 'is_error' => 0, diff --git a/api/v3/examples/Contact/APIChainedArrayFormats.php b/api/v3/examples/Contact/APIChainedArrayFormats.php index 02c3231881..e9c897a066 100644 --- a/api/v3/examples/Contact/APIChainedArrayFormats.php +++ b/api/v3/examples/Contact/APIChainedArrayFormats.php @@ -81,10 +81,7 @@ function contact_get_expectedresult(){ 'geo_code_1' => '', 'geo_code_2' => '', 'state_province_id' => '', - 'state_province_name' => '', - 'state_province' => '', 'country_id' => '', - 'country' => '', 'phone_id' => '', 'phone_type_id' => '', 'phone' => '', @@ -96,6 +93,9 @@ function contact_get_expectedresult(){ 'im' => '', 'worldregion_id' => '', 'world_region' => '', + 'state_province_name' => '', + 'state_province' => '', + 'country' => '', 'id' => '1', 'api.website.getValue' => 'http://civicrm.org', 'api.Contribution.getCount' => 2, diff --git a/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php b/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php index 3409d3538a..b4fbab404c 100644 --- a/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php +++ b/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php @@ -78,10 +78,7 @@ function contact_get_expectedresult(){ 'geo_code_1' => '', 'geo_code_2' => '', 'state_province_id' => '', - 'state_province_name' => '', - 'state_province' => '', 'country_id' => '', - 'country' => '', 'phone_id' => '', 'phone_type_id' => '', 'phone' => '', @@ -93,6 +90,9 @@ function contact_get_expectedresult(){ 'im' => '', 'worldregion_id' => '', 'world_region' => '', + 'state_province_name' => '', + 'state_province' => '', + 'country' => '', 'id' => '1', 'api.website.getValue' => 'http://civicrm.org', 'api.Contribution.getCount' => 2, diff --git a/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php b/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php index f4721e23b9..2b37455158 100644 --- a/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php +++ b/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php @@ -68,6 +68,8 @@ function contact_create_expectedresult(){ 'first_name' => '', 'middle_name' => '', 'last_name' => '', + 'prefix_id' => '', + 'suffix_id' => '', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => '', diff --git a/api/v3/examples/Contact/ChainTwoWebsites.php b/api/v3/examples/Contact/ChainTwoWebsites.php index 54a3444fa4..6b1880fb37 100644 --- a/api/v3/examples/Contact/ChainTwoWebsites.php +++ b/api/v3/examples/Contact/ChainTwoWebsites.php @@ -80,6 +80,8 @@ function contact_create_expectedresult(){ 'first_name' => 'abc3', 'middle_name' => '', 'last_name' => 'xyz3', + 'prefix_id' => '', + 'suffix_id' => '', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => '', @@ -134,7 +136,7 @@ function contact_create_expectedresult(){ 'contribution_status_id' => '1', 'honor_type_id' => '', 'address_id' => '', - 'check_number' => 'null', + 'check_number' => '', 'campaign_id' => '', 'contribution_type_id' => '1', ), diff --git a/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php b/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php index 5bc0f922fa..c5474b2d75 100644 --- a/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php +++ b/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php @@ -83,6 +83,8 @@ function contact_create_expectedresult(){ 'first_name' => 'abc3', 'middle_name' => '', 'last_name' => 'xyz3', + 'prefix_id' => '', + 'suffix_id' => '', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => '', @@ -137,7 +139,7 @@ function contact_create_expectedresult(){ 'contribution_status_id' => '1', 'honor_type_id' => '', 'address_id' => '', - 'check_number' => 'null', + 'check_number' => '', 'campaign_id' => '', 'contribution_type_id' => '1', ), diff --git a/api/v3/examples/Contact/GetFieldsOptions.php b/api/v3/examples/Contact/GetFieldsOptions.php index 032ddc9c02..5605b345f3 100644 --- a/api/v3/examples/Contact/GetFieldsOptions.php +++ b/api/v3/examples/Contact/GetFieldsOptions.php @@ -308,6 +308,32 @@ function contact_getfields_expectedresult(){ 'dataPattern' => '/^\w+(\s\w+)?+$/', 'export' => true, ), + 'prefix_id' => array( + 'name' => 'prefix_id', + 'type' => 1, + 'title' => 'Individual Prefix', + 'import' => true, + 'where' => 'civicrm_contact.prefix_id', + 'headerPattern' => '/^(prefix|title)/i', + 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\.?$/i', + 'export' => true, + 'pseudoconstant' => array( + 'optionGroupName' => 'individual_prefix', + ), + ), + 'suffix_id' => array( + 'name' => 'suffix_id', + 'type' => 1, + 'title' => 'Individual Suffix', + 'import' => true, + 'where' => 'civicrm_contact.suffix_id', + 'headerPattern' => '/^suffix$/i', + 'dataPattern' => '/^(sr|jr)\.?|i{2,}$/', + 'export' => true, + 'pseudoconstant' => array( + 'optionGroupName' => 'individual_suffix', + ), + ), 'email_greeting_id' => array( 'name' => 'email_greeting_id', 'type' => 1, @@ -503,34 +529,6 @@ function contact_getfields_expectedresult(){ 'export' => true, 'uniqueName' => 'contact_source', ), - 'prefix_id' => array( - 'name' => 'prefix_id', - 'type' => 1, - 'title' => 'Individual Prefix', - 'import' => true, - 'where' => 'civicrm_contact.prefix_id', - 'headerPattern' => '/^(prefix|title)/i', - 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\.?$/i', - 'export' => true, - 'pseudoconstant' => array( - 'optionGroupName' => 'individual_prefix', - ), - 'uniqueName' => 'individual_prefix_id', - ), - 'suffix_id' => array( - 'name' => 'suffix_id', - 'type' => 1, - 'title' => 'Individual Suffix', - 'import' => true, - 'where' => 'civicrm_contact.suffix_id', - 'headerPattern' => '/^suffix$/i', - 'dataPattern' => '/^(sr|jr)\.?|i{2,}$/', - 'export' => true, - 'pseudoconstant' => array( - 'optionGroupName' => 'individual_suffix', - ), - 'uniqueName' => 'individual_suffix_id', - ), 'employer_id' => array( 'name' => 'employer_id', 'type' => 1, diff --git a/api/v3/examples/Contact/GetSingleContact.php b/api/v3/examples/Contact/GetSingleContact.php index 6b22a2f9a1..2df6565a5a 100644 --- a/api/v3/examples/Contact/GetSingleContact.php +++ b/api/v3/examples/Contact/GetSingleContact.php @@ -69,10 +69,7 @@ function contact_getsingle_expectedresult(){ 'geo_code_1' => '', 'geo_code_2' => '', 'state_province_id' => '', - 'state_province_name' => '', - 'state_province' => '', 'country_id' => '', - 'country' => '', 'phone_id' => '', 'phone_type_id' => '', 'phone' => '', @@ -84,6 +81,9 @@ function contact_getsingle_expectedresult(){ 'im' => '', 'worldregion_id' => '', 'world_region' => '', + 'state_province_name' => '', + 'state_province' => '', + 'country' => '', 'id' => '17', ); diff --git a/api/v3/examples/Contact/GroupFilterUsingContactAPI.php b/api/v3/examples/Contact/GroupFilterUsingContactAPI.php index 3c76bda6af..42c6ab91db 100644 --- a/api/v3/examples/Contact/GroupFilterUsingContactAPI.php +++ b/api/v3/examples/Contact/GroupFilterUsingContactAPI.php @@ -77,10 +77,7 @@ function contact_get_expectedresult(){ 'geo_code_1' => '', 'geo_code_2' => '', 'state_province_id' => '', - 'state_province_name' => '', - 'state_province' => '', 'country_id' => '', - 'country' => '', 'phone_id' => '', 'phone_type_id' => '', 'phone' => '', @@ -92,6 +89,9 @@ function contact_get_expectedresult(){ 'im' => '', 'worldregion_id' => '', 'world_region' => '', + 'state_province_name' => '', + 'state_province' => '', + 'country' => '', 'id' => '1', ), ), diff --git a/api/v3/examples/ContactCreate.php b/api/v3/examples/ContactCreate.php index 12bf3d8edd..0b7b39c699 100644 --- a/api/v3/examples/ContactCreate.php +++ b/api/v3/examples/ContactCreate.php @@ -61,6 +61,8 @@ function contact_create_expectedresult(){ 'first_name' => 'abc1', 'middle_name' => '', 'last_name' => 'xyz1', + 'prefix_id' => '', + 'suffix_id' => '', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => '', diff --git a/api/v3/examples/ContactGet.php b/api/v3/examples/ContactGet.php index a597b7bbf8..5b6cd352ed 100644 --- a/api/v3/examples/ContactGet.php +++ b/api/v3/examples/ContactGet.php @@ -73,10 +73,7 @@ function contact_get_expectedresult(){ 'geo_code_1' => '', 'geo_code_2' => '', 'state_province_id' => '', - 'state_province_name' => '', - 'state_province' => '', 'country_id' => '', - 'country' => '', 'phone_id' => '', 'phone_type_id' => '', 'phone' => '', @@ -88,6 +85,9 @@ function contact_get_expectedresult(){ 'im' => '', 'worldregion_id' => '', 'world_region' => '', + 'state_province_name' => '', + 'state_province' => '', + 'country' => '', 'id' => '1', ), ), diff --git a/api/v3/examples/Contribution/ContributionCreateWithNote.php b/api/v3/examples/Contribution/ContributionCreateWithNote.php index efd3a0c1bd..dd139fea77 100644 --- a/api/v3/examples/Contribution/ContributionCreateWithNote.php +++ b/api/v3/examples/Contribution/ContributionCreateWithNote.php @@ -72,7 +72,7 @@ function contribution_create_expectedresult(){ 'contribution_status_id' => '1', 'honor_type_id' => '', 'address_id' => '', - 'check_number' => 'null', + 'check_number' => '', 'campaign_id' => '', 'contribution_type_id' => '1', ), diff --git a/api/v3/examples/Contribution/CreateWithNestedLineItems.php b/api/v3/examples/Contribution/CreateWithNestedLineItems.php index 4f00ff1846..4ad4565a66 100644 --- a/api/v3/examples/Contribution/CreateWithNestedLineItems.php +++ b/api/v3/examples/Contribution/CreateWithNestedLineItems.php @@ -86,7 +86,7 @@ function contribution_create_expectedresult(){ 'contribution_status_id' => '1', 'honor_type_id' => '', 'address_id' => '', - 'check_number' => 'null', + 'check_number' => '', 'campaign_id' => '', 'contribution_type_id' => '1', 'api.line_item.create' => array( diff --git a/api/v3/examples/ContributionPageCreate.php b/api/v3/examples/ContributionPageCreate.php index ae07948fb1..11be46d350 100644 --- a/api/v3/examples/ContributionPageCreate.php +++ b/api/v3/examples/ContributionPageCreate.php @@ -81,7 +81,7 @@ function contribution_page_create_expectedresult(){ 'start_date' => '', 'end_date' => '', 'created_id' => '', - 'created_date' => '2013-07-28 08:49:19', + 'created_date' => '', 'currency' => 'NZD', 'campaign_id' => '', 'is_share' => '', diff --git a/api/v3/examples/ContributionRecurCreate.php b/api/v3/examples/ContributionRecurCreate.php index c83fb85f74..6fe28ad389 100644 --- a/api/v3/examples/ContributionRecurCreate.php +++ b/api/v3/examples/ContributionRecurCreate.php @@ -48,9 +48,9 @@ function contribution_recur_create_expectedresult(){ 'frequency_unit' => 'day', 'frequency_interval' => '1', 'installments' => '12', - 'start_date' => '20120101000000', + 'start_date' => '2013-07-29 00:00:00', 'create_date' => '20120130621222105', - 'modified_date' => '2012-11-14 16:02:35', + 'modified_date' => '', 'cancel_date' => '', 'end_date' => '', 'processor_id' => '', diff --git a/api/v3/examples/ContributionRecurGet.php b/api/v3/examples/ContributionRecurGet.php index 6158d65a30..4218e7458b 100644 --- a/api/v3/examples/ContributionRecurGet.php +++ b/api/v3/examples/ContributionRecurGet.php @@ -41,7 +41,7 @@ function contribution_recur_get_expectedresult(){ 'frequency_unit' => 'day', 'frequency_interval' => '1', 'installments' => '12', - 'start_date' => '2012-01-01 00:00:00', + 'start_date' => '2013-07-29 00:00:00', 'create_date' => '20120130621222105', 'contribution_status_id' => '1', 'is_test' => 0, diff --git a/api/v3/examples/CustomGroupCreate.php b/api/v3/examples/CustomGroupCreate.php index 7aa448a1d6..235eb182e4 100644 --- a/api/v3/examples/CustomGroupCreate.php +++ b/api/v3/examples/CustomGroupCreate.php @@ -48,8 +48,8 @@ function custom_group_create_expectedresult(){ 'name' => 'test_group_1', 'title' => 'Test_Group_1', 'extends' => 'Individual', - 'extends_entity_column_id' => 'null', - 'extends_entity_column_value' => 'null', + 'extends_entity_column_id' => '', + 'extends_entity_column_value' => '', 'style' => 'Inline', 'collapse_display' => '1', 'help_pre' => 'This is Pre Help For Test Group 1', @@ -59,10 +59,10 @@ function custom_group_create_expectedresult(){ 'table_name' => 'civicrm_value_test_group_1_1', 'is_multiple' => '', 'min_multiple' => '', - 'max_multiple' => 'null', + 'max_multiple' => '', 'collapse_adv_display' => '', 'created_id' => '', - 'created_date' => '2013-07-28 08:49:19', + 'created_date' => '', 'is_reserved' => '', ), ), diff --git a/api/v3/examples/Email/NestedReplaceEmail.php b/api/v3/examples/Email/NestedReplaceEmail.php index 0e11d25e25..8f6a1b116c 100644 --- a/api/v3/examples/Email/NestedReplaceEmail.php +++ b/api/v3/examples/Email/NestedReplaceEmail.php @@ -102,10 +102,7 @@ function email_replace_expectedresult(){ 'geo_code_1' => '', 'geo_code_2' => '', 'state_province_id' => '', - 'state_province_name' => '', - 'state_province' => '', 'country_id' => '', - 'country' => '', 'phone_id' => '', 'phone_type_id' => '', 'phone' => '', @@ -117,6 +114,9 @@ function email_replace_expectedresult(){ 'im' => '', 'worldregion_id' => '', 'world_region' => '', + 'state_province_name' => '', + 'state_province' => '', + 'country' => '', 'id' => '10', 'api.email.replace' => array( 'is_error' => 0, diff --git a/api/v3/examples/Event/IsFullOption.php b/api/v3/examples/Event/IsFullOption.php index 37de47de34..7c49f621bb 100644 --- a/api/v3/examples/Event/IsFullOption.php +++ b/api/v3/examples/Event/IsFullOption.php @@ -50,7 +50,7 @@ function event_getsingle_expectedresult(){ 'is_multiple_registrations' => 0, 'allow_same_participant_emails' => 0, 'is_template' => 0, - 'created_date' => '2013-07-28 19:57:44', + 'created_date' => '2013-08-03 21:23:22', 'is_share' => '1', 'available_places' => 0, 'is_full' => '1', diff --git a/api/v3/examples/EventCreate.php b/api/v3/examples/EventCreate.php index 5ac4c699c8..3b55e4d79b 100644 --- a/api/v3/examples/EventCreate.php +++ b/api/v3/examples/EventCreate.php @@ -55,8 +55,8 @@ function event_create_expectedresult(){ 'event_type_id' => '1', 'participant_listing_id' => '', 'is_public' => '1', - 'start_date' => '20081021000000', - 'end_date' => '20081023000000', + 'start_date' => '2013-07-29 00:00:00', + 'end_date' => '2013-08-04 00:00:00', 'is_online_registration' => '1', 'registration_link_text' => '', 'registration_start_date' => '20080601000000', diff --git a/api/v3/examples/EventGet.php b/api/v3/examples/EventGet.php index f57b517172..400d3dcaa5 100644 --- a/api/v3/examples/EventGet.php +++ b/api/v3/examples/EventGet.php @@ -41,8 +41,8 @@ function event_get_expectedresult(){ 'event_type_id' => '1', 'participant_listing_id' => 0, 'is_public' => '1', - 'start_date' => '2008-10-21 00:00:00', - 'event_start_date' => '2008-10-21 00:00:00', + 'start_date' => '2013-07-29 00:00:00', + 'event_start_date' => '2013-07-29 00:00:00', 'is_online_registration' => 0, 'is_monetary' => 0, 'is_map' => 0, diff --git a/api/v3/examples/GrantCreate.php b/api/v3/examples/GrantCreate.php index 37d928094e..97a42badf5 100644 --- a/api/v3/examples/GrantCreate.php +++ b/api/v3/examples/GrantCreate.php @@ -44,7 +44,7 @@ function grant_create_expectedresult(){ 'id' => '1', 'contact_id' => '3', 'application_received_date' => '20130728084957', - 'decision_date' => '20130729000000', + 'decision_date' => '20130805000000', 'money_transfer_date' => '', 'grant_due_date' => '', 'grant_report_received' => '', diff --git a/api/v3/examples/GrantGet.php b/api/v3/examples/GrantGet.php index af79074882..0b340841e0 100644 --- a/api/v3/examples/GrantGet.php +++ b/api/v3/examples/GrantGet.php @@ -37,7 +37,7 @@ function grant_get_expectedresult(){ 'id' => '2', 'contact_id' => '4', 'application_received_date' => '20130728084957', - 'decision_date' => '2013-07-29', + 'decision_date' => '2013-08-05', 'grant_type_id' => '1', 'amount_total' => '500.00', 'currency' => 'USD', diff --git a/api/v3/examples/GroupContact/GetWithGroupID.php b/api/v3/examples/GroupContact/GetWithGroupID.php index f41d8fb6f7..4832c484bc 100644 --- a/api/v3/examples/GroupContact/GetWithGroupID.php +++ b/api/v3/examples/GroupContact/GetWithGroupID.php @@ -55,7 +55,7 @@ function group_contact_get_expectedresult(){ 'is_active' => '1', 'visibility' => 'Public Pages', 'where_clause' => ' ( `civicrm_group_contact-1`.group_id IN ( 1 ) AND `civicrm_group_contact-1`.status IN ("Added") ) ', - 'select_tables' => 'a:9:{s:15:"civicrm_contact";i:1;s:15:"civicrm_address";i:1;s:22:"civicrm_state_province";i:1;s:15:"civicrm_country";i:1;s:13:"civicrm_email";i:1;s:13:"civicrm_phone";i:1;s:10:"civicrm_im";i:1;s:19:"civicrm_worldregion";i:1;s:25:"`civicrm_group_contact-1`";s:114:" LEFT JOIN civicrm_group_contact `civicrm_group_contact-1` ON contact_a.id = `civicrm_group_contact-1`.contact_id ";}', + 'select_tables' => 'a:8:{s:15:"civicrm_contact";i:1;s:15:"civicrm_address";i:1;s:15:"civicrm_country";i:1;s:13:"civicrm_email";i:1;s:13:"civicrm_phone";i:1;s:10:"civicrm_im";i:1;s:19:"civicrm_worldregion";i:1;s:25:"`civicrm_group_contact-1`";s:114:" LEFT JOIN civicrm_group_contact `civicrm_group_contact-1` ON contact_a.id = `civicrm_group_contact-1`.contact_id ";}', 'where_tables' => 'a:2:{s:15:"civicrm_contact";i:1;s:25:"`civicrm_group_contact-1`";s:114:" LEFT JOIN civicrm_group_contact `civicrm_group_contact-1` ON contact_a.id = `civicrm_group_contact-1`.contact_id ";}', 'group_type' => array( '0' => '1', @@ -93,7 +93,7 @@ function group_contact_get_expectedresult(){ 'is_active' => '1', 'visibility' => 'Public Pages', 'where_clause' => ' ( `civicrm_group_contact-1`.group_id IN ( 1 ) AND `civicrm_group_contact-1`.status IN ("Added") ) ', - 'select_tables' => 'a:9:{s:15:"civicrm_contact";i:1;s:15:"civicrm_address";i:1;s:22:"civicrm_state_province";i:1;s:15:"civicrm_country";i:1;s:13:"civicrm_email";i:1;s:13:"civicrm_phone";i:1;s:10:"civicrm_im";i:1;s:19:"civicrm_worldregion";i:1;s:25:"`civicrm_group_contact-1`";s:114:" LEFT JOIN civicrm_group_contact `civicrm_group_contact-1` ON contact_a.id = `civicrm_group_contact-1`.contact_id ";}', + 'select_tables' => 'a:8:{s:15:"civicrm_contact";i:1;s:15:"civicrm_address";i:1;s:15:"civicrm_country";i:1;s:13:"civicrm_email";i:1;s:13:"civicrm_phone";i:1;s:10:"civicrm_im";i:1;s:19:"civicrm_worldregion";i:1;s:25:"`civicrm_group_contact-1`";s:114:" LEFT JOIN civicrm_group_contact `civicrm_group_contact-1` ON contact_a.id = `civicrm_group_contact-1`.contact_id ";}', 'where_tables' => 'a:2:{s:15:"civicrm_contact";i:1;s:25:"`civicrm_group_contact-1`";s:114:" LEFT JOIN civicrm_group_contact `civicrm_group_contact-1` ON contact_a.id = `civicrm_group_contact-1`.contact_id ";}', 'group_type' => array( '0' => '1', diff --git a/api/v3/examples/GroupGet.php b/api/v3/examples/GroupGet.php index ce5e3093d1..814907546a 100644 --- a/api/v3/examples/GroupGet.php +++ b/api/v3/examples/GroupGet.php @@ -43,7 +43,7 @@ function group_get_expectedresult(){ 'is_active' => '1', 'visibility' => 'Public Pages', 'where_clause' => ' ( `civicrm_group_contact-4`.group_id IN ( 4 ) AND `civicrm_group_contact-4`.status IN ("Added") ) ', - 'select_tables' => 'a:9:{s:15:"civicrm_contact";i:1;s:15:"civicrm_address";i:1;s:22:"civicrm_state_province";i:1;s:15:"civicrm_country";i:1;s:13:"civicrm_email";i:1;s:13:"civicrm_phone";i:1;s:10:"civicrm_im";i:1;s:19:"civicrm_worldregion";i:1;s:25:"`civicrm_group_contact-4`";s:114:" LEFT JOIN civicrm_group_contact `civicrm_group_contact-4` ON contact_a.id = `civicrm_group_contact-4`.contact_id ";}', + 'select_tables' => 'a:8:{s:15:"civicrm_contact";i:1;s:15:"civicrm_address";i:1;s:15:"civicrm_country";i:1;s:13:"civicrm_email";i:1;s:13:"civicrm_phone";i:1;s:10:"civicrm_im";i:1;s:19:"civicrm_worldregion";i:1;s:25:"`civicrm_group_contact-4`";s:114:" LEFT JOIN civicrm_group_contact `civicrm_group_contact-4` ON contact_a.id = `civicrm_group_contact-4`.contact_id ";}', 'where_tables' => 'a:2:{s:15:"civicrm_contact";i:1;s:25:"`civicrm_group_contact-4`";s:114:" LEFT JOIN civicrm_group_contact `civicrm_group_contact-4` ON contact_a.id = `civicrm_group_contact-4`.contact_id ";}', 'group_type' => array( '0' => '1', diff --git a/api/v3/examples/LocBlockCreateEntities.php b/api/v3/examples/LocBlockCreateEntities.php index c205135a92..7d28bce873 100644 --- a/api/v3/examples/LocBlockCreateEntities.php +++ b/api/v3/examples/LocBlockCreateEntities.php @@ -59,7 +59,7 @@ function loc_block_createentities_expectedresult(){ ), 'email' => array( 'id' => '4', - 'contact_id' => 'null', + 'contact_id' => '', 'location_type_id' => '1', 'email' => 'test2@loc.block', 'is_primary' => 0, @@ -73,7 +73,7 @@ function loc_block_createentities_expectedresult(){ ), 'phone' => array( 'id' => '3', - 'contact_id' => 'null', + 'contact_id' => '', 'location_type_id' => '1', 'is_primary' => 0, 'is_billing' => '', @@ -85,7 +85,7 @@ function loc_block_createentities_expectedresult(){ ), 'phone_2' => array( 'id' => '4', - 'contact_id' => 'null', + 'contact_id' => '', 'location_type_id' => '1', 'is_primary' => 0, 'is_billing' => '', diff --git a/api/v3/examples/MailingCreate.php b/api/v3/examples/MailingCreate.php index 90e2b993bb..77f76a7f46 100644 --- a/api/v3/examples/MailingCreate.php +++ b/api/v3/examples/MailingCreate.php @@ -39,8 +39,8 @@ function mailing_create_expectedresult(){ '1' => array( 'id' => '1', 'domain_id' => '1', - 'header_id' => 'null', - 'footer_id' => 'null', + 'header_id' => '', + 'footer_id' => '', 'reply_id' => '', 'unsubscribe_id' => '', 'resubscribe_id' => '', diff --git a/api/v3/examples/MailingGroupSubscribe.php b/api/v3/examples/MailingGroupSubscribe.php index 23c4e8c9df..ef287f111d 100644 --- a/api/v3/examples/MailingGroupSubscribe.php +++ b/api/v3/examples/MailingGroupSubscribe.php @@ -34,12 +34,14 @@ function mailing_group_subscribe_expectedresult(){ $expectedResult = array( 'is_error' => 0, 'version' => 3, - 'count' => 4, + 'count' => 1, + 'id' => 1, 'values' => array( - 'contact_id' => '3', - 'subscribe_id' => '1', - 'hash' => 'bf4d724dbbb38c0c', - 'is_error' => 0, + '1' => array( + 'contact_id' => '3', + 'subscribe_id' => '1', + 'hash' => '67eac7789eaee00', + ), ), ); diff --git a/api/v3/examples/Membership/filterIsCurrent.php b/api/v3/examples/Membership/filterIsCurrent.php index 2bf364e3ab..676626ff3e 100644 --- a/api/v3/examples/Membership/filterIsCurrent.php +++ b/api/v3/examples/Membership/filterIsCurrent.php @@ -43,9 +43,9 @@ function membership_get_expectedresult(){ 'membership_contact_id' => '13', 'membership_type_id' => '11', 'join_date' => '2009-01-21', - 'start_date' => '2009-01-21', + 'start_date' => '2013-07-29 00:00:00', 'membership_start_date' => '2009-01-21', - 'end_date' => '2009-12-21', + 'end_date' => '2013-08-04 00:00:00', 'membership_end_date' => '2009-12-21', 'source' => 'Payment', 'membership_source' => 'Payment', diff --git a/api/v3/examples/MembershipCreate.php b/api/v3/examples/MembershipCreate.php index 47ec1be3ba..c401be31b1 100644 --- a/api/v3/examples/MembershipCreate.php +++ b/api/v3/examples/MembershipCreate.php @@ -46,8 +46,8 @@ function membership_create_expectedresult(){ 'contact_id' => '25', 'membership_type_id' => '22', 'join_date' => '20090121000000', - 'start_date' => '20090121000000', - 'end_date' => '20091221000000', + 'start_date' => '2013-07-29 00:00:00', + 'end_date' => '2013-08-04 00:00:00', 'source' => 'Payment', 'status_id' => '28', 'is_override' => '1', diff --git a/api/v3/examples/MembershipGet.php b/api/v3/examples/MembershipGet.php index fe5bcf0904..7d36c8a8ee 100644 --- a/api/v3/examples/MembershipGet.php +++ b/api/v3/examples/MembershipGet.php @@ -38,8 +38,8 @@ function membership_get_expectedresult(){ 'contact_id' => '10', 'membership_type_id' => '8', 'join_date' => '2009-01-21', - 'start_date' => '2009-01-21', - 'end_date' => '2009-12-21', + 'start_date' => '2013-07-29 00:00:00', + 'end_date' => '2013-08-04 00:00:00', 'source' => 'Payment', 'status_id' => '15', 'is_override' => '1', diff --git a/api/v3/examples/MembershipUpdate.php b/api/v3/examples/MembershipUpdate.php index 53ecc5e652..02df23632b 100644 --- a/api/v3/examples/MembershipUpdate.php +++ b/api/v3/examples/MembershipUpdate.php @@ -46,8 +46,8 @@ function membership_update_expectedresult(){ 'contact_id' => '31', 'membership_type_id' => '28', 'join_date' => '20090121000000', - 'start_date' => '20090121000000', - 'end_date' => '20091221000000', + 'start_date' => '2013-07-29 00:00:00', + 'end_date' => '2013-08-04 00:00:00', 'source' => 'Payment', 'status_id' => '34', 'is_override' => '1', diff --git a/api/v3/examples/Participant/CreateParticipantPayment.php b/api/v3/examples/Participant/CreateParticipantPayment.php index fa103849e8..1242fe3a83 100644 --- a/api/v3/examples/Participant/CreateParticipantPayment.php +++ b/api/v3/examples/Participant/CreateParticipantPayment.php @@ -75,6 +75,8 @@ function participant_create_expectedresult(){ 'first_name' => '', 'middle_name' => '', 'last_name' => '', + 'prefix_id' => '', + 'suffix_id' => '', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => '', diff --git a/api/v3/examples/Participant/NestedDelete.php b/api/v3/examples/Participant/NestedDelete.php index a2a9bc18f3..29e7163161 100644 --- a/api/v3/examples/Participant/NestedDelete.php +++ b/api/v3/examples/Participant/NestedDelete.php @@ -41,8 +41,8 @@ function participant_get_expectedresult(){ 'display_name' => 'Mr. Anthony Anderson II', 'event_id' => '38', 'event_title' => 'Annual CiviCRM meet', - 'event_start_date' => '2008-10-21 00:00:00', - 'event_end_date' => '2008-10-23 00:00:00', + 'event_start_date' => '2013-07-29 00:00:00', + 'event_end_date' => '2013-08-04 00:00:00', 'participant_id' => '2', 'participant_fee_level' => '', 'participant_fee_amount' => '', @@ -75,8 +75,8 @@ function participant_get_expectedresult(){ 'display_name' => 'Mr. Anthony Anderson II', 'event_id' => '38', 'event_title' => 'Annual CiviCRM meet', - 'event_start_date' => '2008-10-21 00:00:00', - 'event_end_date' => '2008-10-23 00:00:00', + 'event_start_date' => '2013-07-29 00:00:00', + 'event_end_date' => '2013-08-04 00:00:00', 'participant_id' => '3', 'participant_fee_level' => '', 'participant_fee_amount' => '', diff --git a/api/v3/examples/Participant/NestedEventGet.php b/api/v3/examples/Participant/NestedEventGet.php index 2566c1bc4b..31eaf2fa9c 100644 --- a/api/v3/examples/Participant/NestedEventGet.php +++ b/api/v3/examples/Participant/NestedEventGet.php @@ -42,8 +42,8 @@ function participant_get_expectedresult(){ 'display_name' => 'Mr. Anthony Anderson II', 'event_id' => '6', 'event_title' => 'Annual CiviCRM meet', - 'event_start_date' => '2008-10-21 00:00:00', - 'event_end_date' => '2008-10-23 00:00:00', + 'event_start_date' => '2013-07-29 00:00:00', + 'event_end_date' => '2013-08-04 00:00:00', 'participant_id' => '1', 'participant_fee_level' => '', 'participant_fee_amount' => '', @@ -77,10 +77,10 @@ function participant_get_expectedresult(){ 'event_type_id' => '1', 'participant_listing_id' => 0, 'is_public' => '1', - 'start_date' => '2008-10-21 00:00:00', - 'event_start_date' => '2008-10-21 00:00:00', - 'end_date' => '2008-10-23 00:00:00', - 'event_end_date' => '2008-10-23 00:00:00', + 'start_date' => '2013-07-29 00:00:00', + 'event_start_date' => '2013-07-29 00:00:00', + 'end_date' => '2013-08-04 00:00:00', + 'event_end_date' => '2013-08-04 00:00:00', 'is_online_registration' => '1', 'registration_start_date' => '2008-06-01 00:00:00', 'registration_end_date' => '2008-10-15 00:00:00', diff --git a/api/v3/examples/ParticipantGet.php b/api/v3/examples/ParticipantGet.php index 9e4e31a827..f2f7752317 100644 --- a/api/v3/examples/ParticipantGet.php +++ b/api/v3/examples/ParticipantGet.php @@ -41,8 +41,8 @@ function participant_get_expectedresult(){ 'display_name' => 'Mr. Anthony Anderson II', 'event_id' => '5', 'event_title' => 'Annual CiviCRM meet', - 'event_start_date' => '2008-10-21 00:00:00', - 'event_end_date' => '2008-10-23 00:00:00', + 'event_start_date' => '2013-07-29 00:00:00', + 'event_end_date' => '2013-08-04 00:00:00', 'participant_id' => '1', 'participant_fee_level' => '', 'participant_fee_amount' => '', diff --git a/api/v3/examples/Pledge/GetFilterHighDate.php b/api/v3/examples/Pledge/GetFilterHighDate.php index 44eb58d308..8534a0a149 100644 --- a/api/v3/examples/Pledge/GetFilterHighDate.php +++ b/api/v3/examples/Pledge/GetFilterHighDate.php @@ -5,7 +5,7 @@ */ function pledge_get_example(){ $params = array( - 'pledge_start_date_high' => '20130726201306', + 'pledge_start_date_high' => '20130801213843', ); try{ @@ -41,7 +41,7 @@ function pledge_get_expectedresult(){ 'display_name' => 'Mr. Anthony Anderson II', 'pledge_id' => '2', 'pledge_amount' => '100.00', - 'pledge_create_date' => '2013-07-28 00:00:00', + 'pledge_create_date' => '2013-08-03 00:00:00', 'pledge_status' => 'Overdue', 'pledge_total_paid' => '', 'pledge_next_pay_date' => '2012-03-02 00:00:00', diff --git a/api/v3/examples/PledgeCreate.php b/api/v3/examples/PledgeCreate.php index 70b6ad5317..fece5a44d6 100644 --- a/api/v3/examples/PledgeCreate.php +++ b/api/v3/examples/PledgeCreate.php @@ -6,9 +6,9 @@ function pledge_create_example(){ $params = array( 'contact_id' => 11, - 'pledge_create_date' => '20130728', - 'start_date' => '20130728', - 'scheduled_date' => '20130730', + 'pledge_create_date' => '20130803', + 'start_date' => '20130803', + 'scheduled_date' => '20130805', 'amount' => '100', 'pledge_status_id' => '2', 'pledge_financial_type_id' => '1', @@ -57,10 +57,10 @@ function pledge_create_expectedresult(){ 'frequency_interval' => '5', 'frequency_day' => '15', 'installments' => '5', - 'start_date' => '20130728000000', + 'start_date' => '2013-07-29 00:00:00', 'create_date' => '20120130621222105', 'acknowledge_date' => '', - 'modified_date' => '2012-11-14 16:02:35', + 'modified_date' => '', 'cancel_date' => '', 'end_date' => '', 'honor_contact_id' => '', diff --git a/api/v3/examples/PledgeGet.php b/api/v3/examples/PledgeGet.php index c50cb5bba8..8fa605ca09 100644 --- a/api/v3/examples/PledgeGet.php +++ b/api/v3/examples/PledgeGet.php @@ -41,10 +41,10 @@ function pledge_get_expectedresult(){ 'display_name' => 'Mr. Anthony Anderson II', 'pledge_id' => '1', 'pledge_amount' => '100.00', - 'pledge_create_date' => '2013-07-28 00:00:00', + 'pledge_create_date' => '2013-08-03 00:00:00', 'pledge_status' => 'Pending', 'pledge_total_paid' => '', - 'pledge_next_pay_date' => '2013-07-30 00:00:00', + 'pledge_next_pay_date' => '2013-08-05 00:00:00', 'pledge_next_pay_amount' => '20.00', 'pledge_outstanding_amount' => '', 'pledge_financial_type' => 'Donation', diff --git a/api/v3/examples/PledgePaymentCreate.php b/api/v3/examples/PledgePaymentCreate.php index 1e91350edf..d7b10206c8 100644 --- a/api/v3/examples/PledgePaymentCreate.php +++ b/api/v3/examples/PledgePaymentCreate.php @@ -44,7 +44,7 @@ function pledge_payment_create_expectedresult(){ 'scheduled_amount' => '', 'actual_amount' => '20', 'currency' => 'USD', - 'scheduled_date' => '20130728085413', + 'scheduled_date' => '', 'reminder_date' => '', 'reminder_count' => '', 'status_id' => '1', diff --git a/api/v3/examples/ProfileSet.php b/api/v3/examples/ProfileSet.php index df358ea6e1..835ae7079a 100644 --- a/api/v3/examples/ProfileSet.php +++ b/api/v3/examples/ProfileSet.php @@ -65,6 +65,8 @@ function profile_set_expectedresult(){ 'first_name' => 'abc2', 'middle_name' => '', 'last_name' => 'xyz2', + 'prefix_id' => '', + 'suffix_id' => '', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => 'Dear abc1', @@ -73,7 +75,7 @@ function profile_set_expectedresult(){ 'postal_greeting_display' => 'Dear abc1', 'addressee_id' => '1', 'addressee_custom' => '', - 'addressee_display' => '{contact.individual_prefix} abc1 {contact.middle_name} xyz1 {contact.individual_suffix}', + 'addressee_display' => '{contact.individual_prefix} abc1 xyz1 {contact.individual_suffix}', 'job_title' => '', 'gender_id' => '', 'birth_date' => '', diff --git a/api/v3/examples/Relationship/BetweenRelationshipType.php b/api/v3/examples/Relationship/BetweenRelationshipType.php index e3191c4aee..152a9ca8b8 100644 --- a/api/v3/examples/Relationship/BetweenRelationshipType.php +++ b/api/v3/examples/Relationship/BetweenRelationshipType.php @@ -42,7 +42,7 @@ function relationship_get_expectedresult(){ 'contact_id_a' => '63', 'contact_id_b' => '64', 'relationship_type_id' => '32', - 'start_date' => '2008-12-20', + 'start_date' => '2013-07-29 00:00:00', 'is_active' => '1', 'description' => '', 'is_permission_a_b' => 0, @@ -53,7 +53,7 @@ function relationship_get_expectedresult(){ 'contact_id_a' => '63', 'contact_id_b' => '64', 'relationship_type_id' => '33', - 'start_date' => '2008-12-20', + 'start_date' => '2013-07-29 00:00:00', 'is_active' => '1', 'description' => '', 'is_permission_a_b' => 0, @@ -64,7 +64,7 @@ function relationship_get_expectedresult(){ 'contact_id_a' => '63', 'contact_id_b' => '64', 'relationship_type_id' => '34', - 'start_date' => '2008-12-20', + 'start_date' => '2013-07-29 00:00:00', 'is_active' => '1', 'description' => '', 'is_permission_a_b' => 0, diff --git a/api/v3/examples/Relationship/INRelationshipType.php b/api/v3/examples/Relationship/INRelationshipType.php index 8d03eb93d5..b1b8d7c588 100644 --- a/api/v3/examples/Relationship/INRelationshipType.php +++ b/api/v3/examples/Relationship/INRelationshipType.php @@ -42,7 +42,7 @@ function relationship_get_expectedresult(){ 'contact_id_a' => '63', 'contact_id_b' => '64', 'relationship_type_id' => '32', - 'start_date' => '2008-12-20', + 'start_date' => '2013-07-29 00:00:00', 'is_active' => '1', 'description' => '', 'is_permission_a_b' => 0, @@ -53,7 +53,7 @@ function relationship_get_expectedresult(){ 'contact_id_a' => '63', 'contact_id_b' => '64', 'relationship_type_id' => '33', - 'start_date' => '2008-12-20', + 'start_date' => '2013-07-29 00:00:00', 'is_active' => '1', 'description' => '', 'is_permission_a_b' => 0, diff --git a/api/v3/examples/Relationship/NotBetweenRelationshipType.php b/api/v3/examples/Relationship/NotBetweenRelationshipType.php index 03a843963c..40037d60d6 100644 --- a/api/v3/examples/Relationship/NotBetweenRelationshipType.php +++ b/api/v3/examples/Relationship/NotBetweenRelationshipType.php @@ -43,7 +43,7 @@ function relationship_get_expectedresult(){ 'contact_id_a' => '63', 'contact_id_b' => '64', 'relationship_type_id' => '31', - 'start_date' => '2008-12-20', + 'start_date' => '2013-07-29 00:00:00', 'is_active' => '1', 'description' => '', 'is_permission_a_b' => 0, diff --git a/api/v3/examples/Relationship/NotInRelationshipType.php b/api/v3/examples/Relationship/NotInRelationshipType.php index fa3bc4ee0b..299a8b7e79 100644 --- a/api/v3/examples/Relationship/NotInRelationshipType.php +++ b/api/v3/examples/Relationship/NotInRelationshipType.php @@ -42,7 +42,7 @@ function relationship_get_expectedresult(){ 'contact_id_a' => '63', 'contact_id_b' => '64', 'relationship_type_id' => '31', - 'start_date' => '2008-12-20', + 'start_date' => '2013-07-29 00:00:00', 'is_active' => '1', 'description' => '', 'is_permission_a_b' => 0, @@ -53,7 +53,7 @@ function relationship_get_expectedresult(){ 'contact_id_a' => '63', 'contact_id_b' => '64', 'relationship_type_id' => '34', - 'start_date' => '2008-12-20', + 'start_date' => '2013-07-29 00:00:00', 'is_active' => '1', 'description' => '', 'is_permission_a_b' => 0, diff --git a/api/v3/examples/Relationship/filterIsCurrent.php b/api/v3/examples/Relationship/filterIsCurrent.php index 14eae6c90b..0116fd8697 100644 --- a/api/v3/examples/Relationship/filterIsCurrent.php +++ b/api/v3/examples/Relationship/filterIsCurrent.php @@ -40,7 +40,7 @@ function relationship_get_expectedresult(){ 'contact_id_a' => '60', 'contact_id_b' => '61', 'relationship_type_id' => '30', - 'start_date' => '2008-12-20', + 'start_date' => '2013-07-29 00:00:00', 'is_active' => '1', 'description' => '', 'is_permission_a_b' => 0, diff --git a/api/v3/examples/RelationshipCreate.php b/api/v3/examples/RelationshipCreate.php index 56ec1672f3..8708deaa32 100644 --- a/api/v3/examples/RelationshipCreate.php +++ b/api/v3/examples/RelationshipCreate.php @@ -44,8 +44,8 @@ function relationship_create_expectedresult(){ 'contact_id_a' => '24', 'contact_id_b' => '25', 'relationship_type_id' => '18', - 'start_date' => '20101030000000', - 'end_date' => '20101230000000', + 'start_date' => '2013-07-29 00:00:00', + 'end_date' => '2013-08-04 00:00:00', 'is_active' => '1', 'description' => '', 'is_permission_a_b' => 0, diff --git a/api/v3/examples/RelationshipGet.php b/api/v3/examples/RelationshipGet.php index 70c830844b..7e2fb5a40f 100644 --- a/api/v3/examples/RelationshipGet.php +++ b/api/v3/examples/RelationshipGet.php @@ -38,7 +38,7 @@ function relationship_get_expectedresult(){ 'contact_id_a' => '33', 'contact_id_b' => '34', 'relationship_type_id' => '21', - 'start_date' => '2008-12-20', + 'start_date' => '2013-07-29 00:00:00', 'is_active' => '1', 'description' => '', 'is_permission_a_b' => 0, diff --git a/api/v3/examples/SurveyCreate.php b/api/v3/examples/SurveyCreate.php index 496e5d795a..e94ceb5fb8 100644 --- a/api/v3/examples/SurveyCreate.php +++ b/api/v3/examples/SurveyCreate.php @@ -56,6 +56,7 @@ function survey_create_expectedresult(){ 'bypass_confirm' => '', 'thankyou_title' => '', 'thankyou_text' => '', + 'is_share' => '', ), ), ); diff --git a/api/v3/examples/TagCreate.php b/api/v3/examples/TagCreate.php index be58d0e7a2..dac7b87d8d 100644 --- a/api/v3/examples/TagCreate.php +++ b/api/v3/examples/TagCreate.php @@ -44,7 +44,7 @@ function tag_create_expectedresult(){ 'is_tagset' => '', 'used_for' => 'civicrm_contact', 'created_id' => '', - 'created_date' => '2013-07-28 05:52:14', + 'created_date' => '2013-07-28 08:49:19', ), ), ); diff --git a/api/v3/examples/TagGet.php b/api/v3/examples/TagGet.php index 76d9f9167b..d828cfacdb 100644 --- a/api/v3/examples/TagGet.php +++ b/api/v3/examples/TagGet.php @@ -42,7 +42,7 @@ function tag_get_expectedresult(){ 'is_reserved' => 0, 'is_tagset' => 0, 'used_for' => 'civicrm_contact', - 'created_date' => '2013-07-28 05:52:14', + 'created_date' => '2013-07-28 08:49:19', ), ), ); diff --git a/api/v3/examples/UFFieldReplace.php b/api/v3/examples/UFFieldReplace.php index 4c31a0e387..0aef06e7db 100644 --- a/api/v3/examples/UFFieldReplace.php +++ b/api/v3/examples/UFFieldReplace.php @@ -78,7 +78,7 @@ function uf_field_replace_expectedresult(){ 'visibility' => 'Public Pages and Listings', 'in_selector' => '', 'is_searchable' => '1', - 'location_type_id' => 'null', + 'location_type_id' => '', 'phone_type_id' => '', 'label' => 'Test First Name', 'field_type' => 'Contact', diff --git a/api/v3/examples/UFGroupCreate.php b/api/v3/examples/UFGroupCreate.php index da390e8221..13753b787d 100644 --- a/api/v3/examples/UFGroupCreate.php +++ b/api/v3/examples/UFGroupCreate.php @@ -57,6 +57,7 @@ function uf_group_create_expectedresult(){ 'is_active' => 0, 'group_type' => 'Individual,Contact', 'title' => 'Test Group', + 'description' => '', 'help_pre' => 'help pre', 'help_post' => 'help post', 'limit_listings_group_id' => '1', @@ -73,7 +74,7 @@ function uf_group_create_expectedresult(){ 'is_reserved' => '1', 'name' => 'Test_Group_2', 'created_id' => '1', - 'created_date' => '2013-07-28 05:52:14', + 'created_date' => '2013-07-28 08:49:19', 'is_proximity_search' => '', ), ), diff --git a/api/v3/examples/UFGroupGet.php b/api/v3/examples/UFGroupGet.php index 81e2a6c9db..b3fd004252 100644 --- a/api/v3/examples/UFGroupGet.php +++ b/api/v3/examples/UFGroupGet.php @@ -54,7 +54,7 @@ function uf_group_get_expectedresult(){ 'is_reserved' => '1', 'name' => 'Test_Group_2', 'created_id' => '1', - 'created_date' => '2013-07-28 05:52:14', + 'created_date' => '2013-07-28 08:49:19', 'is_proximity_search' => 0, ), ), diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 0a2ef235d0..e2d4b8efbb 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -1929,6 +1929,11 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { 'scheduled_date' => '20130728085413', 'approval_date' => '20130728085413', 'pledge_start_date_high' => '20130726090416', + 'start_date' => '2013-07-29 00:00:00', + 'event_start_date' => '2013-07-29 00:00:00', + 'end_date' => '2013-08-04 00:00:00', + 'event_end_date' => '2013-08-04 00:00:00', + 'decision_date' => '20130805000000', ); $keysToUnset = array('xdebug', 'undefined_fields',); @@ -1937,9 +1942,20 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { unset($result[$unwantedKey]); } } + if (isset($result['values'])) { + if(!is_array($result['values'])) { + return; + } + $resultArray = &$result['values']; + } + elseif(is_array($result)) { + $resultArray = &$result; + } + else { + return; + } - if (isset($result['values']) && is_array($result['values'])) { - foreach ($result['values'] as $index => &$values) { + foreach ($resultArray as $index => &$values) { if(!is_array($values)) { continue; } @@ -1959,11 +1975,10 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { if(in_array($key, $keysToUnset)) { unset($values[$key]); } - if(array_key_exists($key, $fieldsToChange)) { + if(array_key_exists($key, $fieldsToChange) && !empty($value)) { $value = $fieldsToChange[$key]; } } - } } } diff --git a/tests/phpunit/api/v3/ActivityTest.php b/tests/phpunit/api/v3/ActivityTest.php index 1dff0275ba..4f6485a85e 100644 --- a/tests/phpunit/api/v3/ActivityTest.php +++ b/tests/phpunit/api/v3/ActivityTest.php @@ -48,6 +48,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase { protected $_apiversion = 3; protected $test_activity_type_value; protected $_contactID; + public $_eNoticeCompliant = TRUE; /** * Test setup for every test @@ -107,15 +108,14 @@ class api_v3_ActivityTest extends CiviUnitTestCase { 'civicrm_activity_contact', ); $this->quickCleanup($tablesToTruncate, TRUE); - $this->callAPISuccess('option_value', 'delete', array('version' => 3, 'id' => $this->test_activity_type_id)); + $this->callAPISuccess('option_value', 'delete', array('id' => $this->test_activity_type_id)); } /** * check with empty array */ function testActivityCreateEmpty() { - $params = array('version' => $this->_apiversion); - $result = $this->callAPIFailure('activity', 'create', $params); + $result = $this->callAPIFailure('activity', 'create', array()); } /** @@ -125,9 +125,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase { $params = array( 'subject' => 'this case should fail', 'scheduled_date_time' => date('Ymd'), - 'version' => $this->_apiversion, ); - $result = $this->callAPIFailure('activity', 'create', $params); } @@ -147,7 +145,6 @@ class api_v3_ActivityTest extends CiviUnitTestCase { 'activity_name' => 'Fubar activity type', 'activity_type_id' => 5, 'scheduled_date_time' => date('Ymd'), - 'version' => $this->_apiversion, ); $result = $this->callAPIFailure('activity', 'create', $params); @@ -188,7 +185,6 @@ class api_v3_ActivityTest extends CiviUnitTestCase { $result = $this->callAPIFailure('activity', 'create', $params); } - /** * Ensure that an invalid activity type causes failure * oddly enough this test was failing because the creation of the invalid type @@ -204,7 +200,6 @@ class api_v3_ActivityTest extends CiviUnitTestCase { 'details' => 'a test activity', 'status_id' => 1, 'activity_type_id' => 'Invalid Test activity type', - 'version' => $this->_apiversion, ); $result = $this->callAPIFailure('activity', 'create', $params); @@ -302,10 +297,9 @@ class api_v3_ActivityTest extends CiviUnitTestCase { * Test civicrm_activity_create() with valid parameters - use type_id */ function testActivityCreateCampaignTypeID() { + CRM_Core_BAO_ConfigSetting::enableComponent('CiviCampaign'); // force reload of config object $config = CRM_Core_Config::singleton(TRUE, TRUE); - - CRM_Core_BAO_ConfigSetting::enableComponent('CiviCampaign'); //flush cache by calling with reset $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name', TRUE); @@ -354,10 +348,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase { 'assignee_contact_id' => $this->_contactID, ); - $result = $this->callAPISuccess('activity', 'create', $params); - //todo test target & assignee are set - - $this->documentMe($params, $result, __FUNCTION__, __FILE__, $description, $subfile); + $result = $this->callAPIAndDocument('activity', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile); $result = $this->callAPISuccess('activity', 'get', array('id' => $result['id'], 'version' => $this->_apiversion, 'return.assignee_contact_id' => 1, 'return.target_contact_id' => 1)); $this->assertEquals($this->_contactID, $result['values'][$result['id']]['assignee_contact_id'][0], 'in line ' . __LINE__); @@ -382,8 +373,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase { $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__); $params = $this->_params; $params['custom_' . $ids['custom_field_id']] = "custom string"; - $result = $this->callAPISuccess($this->_entity, 'create', $params); - $this->documentMe($params, $result, __FUNCTION__, __FILE__); + $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__); $result = $this->callAPISuccess($this->_entity, 'get', array('return.custom_' . $ids['custom_field_id'] => 1, 'version' => 3, 'id' => $result['id'])); $this->assertEquals("custom string", $result['values'][$result['id']]['custom_' . $ids['custom_field_id']], ' in line ' . __LINE__); @@ -416,10 +406,8 @@ class api_v3_ActivityTest extends CiviUnitTestCase { $params = $this->_params; $params['custom_' . $customField['id']] = "$this->_contactID"; - $result = $this->callAPISuccess($this->_entity, 'create', $params); - $this->documentMe($params, $result, __FUNCTION__, __FILE__, $description, $subfile); - $result = $this->callAPISuccess($this->_entity, 'get', array('return.custom_' . $customField['id'] => 1, 'version' => 3, 'id' => $result['id'])); - $this->documentMe($params, $result, __FUNCTION__, __FILE__, 'Get with Contact Ref Custom Field', 'ContactRefCustomFieldGet'); + $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, $description, $subfile, 'Create'); + $result = $this->callAPIAndDocument($this->_entity, 'get', array('return.custom_' . $customField['id'] => 1, 'id' => $result['id']), __FUNCTION__, __FILE__, 'Get with Contact Ref Custom Field', 'ContactRefCustomFieldGet', 'get'); $this->assertEquals('Anderson, Anthony', $result['values'][$result['id']]['custom_' . $customField['id']], ' in line ' . __LINE__); $this->assertEquals($this->_contactID, $result['values'][$result['id']]['custom_' . $customField['id'] . "_id"], ' in line ' . __LINE__); @@ -532,10 +520,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase { ), ); - $result = $this->callAPISuccess('Activity', 'Get', $params); - $this->documentMe($params, $result, __FUNCTION__, __FILE__, $description, $subfile); - - $this->assertAPISuccess($result); + $result = $this->callAPIAndDocument('Activity', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile); $this->assertEquals($activity['id'], $result['id'], 'In line ' . __LINE__); @@ -559,14 +544,13 @@ class api_v3_ActivityTest extends CiviUnitTestCase { 'details' => 'a test activity', 'status_id' => 1, 'activity_name' => 'Test activity type', - 'version' => $this->_apiversion, 'priority_id' => 1, ); - $this->callAPISuccess('Activity', 'Create', $params); - $result = $this->callAPISuccess('Activity', 'Get', array('version' => 3, 'subject' => 'Make-it-Happen Meeting')); + $result = $this->callAPISuccess('Activity', 'Create', $params); + $this->callAPISuccess('Activity', 'Get', array('subject' => 'Make-it-Happen Meeting')); $this->assertEquals(1, $result['count']); $this->assertEquals('Make-it-Happen Meeting', $result['values'][$result['id']]['subject']); - $this->callAPISuccess('Activity', 'Delete', array('version' => 3, 'id' => $result['id'])); + $this->callAPISuccess('Activity', 'Delete', array('id' => $result['id'])); } /* * test that get functioning does filtering @@ -637,8 +621,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase { 'filter.activity_date_time_low' => '20120101000000', 'sequential' => 1, ); - $result = $this->callAPISuccess('Activity', 'Get', $params); - $this->documentMe($params, $result, __FUNCTION__, __FILE__, $description, $subfile); + $result = $this->callAPIAndDocument('Activity', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile); $this->assertEquals(1, $result['count'], 'in line ' . __LINE__); $description = "demonstrates _high filter (at time of writing doesn't work if contact_id is set"; $subfile = "DateTimeHigh"; @@ -649,8 +632,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase { 'filter.activity_date_time_high' => '20120101000000', 'sequential' => 1, ); - $result = $this->callAPISuccess('Activity', 'Get', $params); - $this->documentMe($params, $result, __FUNCTION__, __FILE__, $description, $subfile); + $result = $this->callAPIAndDocument('Activity', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile); $this->assertEquals(1, $result['count']); $this->assertEquals('2011-01-01 00:00:00', $result['values'][0]['activity_date_time'], 'in line ' . __LINE__); @@ -670,21 +652,17 @@ class api_v3_ActivityTest extends CiviUnitTestCase { $params['custom_' . $ids['custom_field_id']] = "custom string"; $result = $this->callAPISuccess($this->_entity, 'create', $params); - $this->assertAPISuccess($result, ' in line ' . __LINE__); + // Retrieve the test value $params = array( 'activity_type_id' => $this->test_activity_type_value, - 'version' => 3, 'sequential' => 1, 'return.custom_' . $ids['custom_field_id'] => 1, ); - $result = $this->callAPISuccess('activity', 'get', $params, TRUE); - $this->documentMe($params, $result, __FUNCTION__, __FILE__); - $this->assertAPISuccess($result, ' in line ' . __LINE__); - $this->assertEquals("custom string", $result['values'][0]['custom_' . $ids['custom_field_id']], ' in line ' . __LINE__); + $result = $this->callAPIAndDocument('activity', 'get', $params, __FUNCTION__, __FILE__); + $this->assertEquals("custom string", $result['values'][0]['custom_' . $ids['custom_field_id']]); - - $this->assertEquals($this->test_activity_type_value, $result['values'][0]['activity_type_id'], 'In line ' . __LINE__); + $this->assertEquals($this->test_activity_type_value, $result['values'][0]['activity_type_id']); $this->assertEquals('test activity type id', $result['values'][0]['subject'], 'In line ' . __LINE__); $this->customFieldDelete($ids['custom_field_id']); $this->customGroupDelete($ids['custom_group_id']); @@ -705,14 +683,10 @@ class api_v3_ActivityTest extends CiviUnitTestCase { $params = array( 'contact_id' => $this->_params['source_contact_id'], 'activity_type_id' => $this->test_activity_type_value, - 'version' => 3, 'sequential' => 1, 'return.custom_' . $ids['custom_field_id'] => 1, ); - $result = $this->callAPISuccess('activity', 'get', $params, TRUE); - $this->assertAPISuccess($result, 'in line ' . __LINE__); - $this->documentMe($params, $result, __FUNCTION__, __FILE__); - $this->assertAPISuccess($result); + $result = $this->callAPIAndDocument('activity', 'get', $params, __FUNCTION__, __FILE__); $this->assertEquals("custom string", $result['values'][0]['custom_' . $ids['custom_field_id']], ' in line ' . __LINE__); $this->assertEquals($this->test_activity_type_value, $result['values'][0]['activity_type_id'], 'In line ' . __LINE__); @@ -771,7 +745,6 @@ class api_v3_ActivityTest extends CiviUnitTestCase { $result = $this->callAPISuccess('activity', 'delete', $params); $this->documentMe($params, $result, __FUNCTION__, __FILE__); - $this->assertAPISuccess($result); } /** @@ -832,11 +805,9 @@ class api_v3_ActivityTest extends CiviUnitTestCase { 'status_id' => 1, 'source_contact_id' => $this->_contactID, 'priority_id' => 1, - 'version' => $this->_apiversion, ); $result = $this->callAPISuccess('activity', 'create', $params); - $this->assertAPISuccess($result, 'in line ' . __LINE__); //hack on date comparison - really we should make getAndCheck smarter to handle dates $params['activity_date_time'] = '2009-10-11 12:34:56'; // we also unset source_contact_id since it is stored in an aux table @@ -870,7 +841,6 @@ class api_v3_ActivityTest extends CiviUnitTestCase { $result = $this->callAPISuccess('activity', 'create', $params); $activityId = $result['id']; - $this->assertAPISuccess($result); $result = $this->callAPISuccess($this->_entity, 'get', array('return.custom_' . $ids['custom_field_id'] => 1, 'version' => 3, 'id' => $result['id'])); $this->assertEquals("custom string", $result['values'][$result['id']]['custom_' . $ids['custom_field_id']], ' in line ' . __LINE__); $this->assertEquals("2009-10-18 00:00:00", $result['values'][$result['id']]['activity_date_time'], ' in line ' . __LINE__); @@ -890,7 +860,6 @@ class api_v3_ActivityTest extends CiviUnitTestCase { 'version' => $this->_apiversion, ); $result = $this->callAPISuccess('Activity', 'Create', $params); - $this->assertAPISuccess($result); $result = $this->callAPISuccess($this->_entity, 'get', array('return.custom_' . $ids['custom_field_id'] => 1, 'version' => 3, 'id' => $result['id'])); $this->assertEquals("Updated my test data", $result['values'][$result['id']]['custom_' . $ids['custom_field_id']], ' in line ' . __LINE__); @@ -930,7 +899,6 @@ class api_v3_ActivityTest extends CiviUnitTestCase { $result = $this->callAPISuccess('Activity', 'Create', $params); $activityId = $result['id']; - $this->assertAPISuccess($result); $getParams = array( 'return.assignee_contact_id' => 1, 'return.target_contact_id' => 1, @@ -970,12 +938,10 @@ class api_v3_ActivityTest extends CiviUnitTestCase { $params = array(); $params['id'] = $activityId; - $params['version'] = $this->_apiversion; $params['assignee_contact_id'] = array($contact3 => $contact3); $params['target_contact_id'] = array($contact4 => $contact4); $result = $this->callAPISuccess('activity', 'create', $params); - $this->assertAPISuccess($result); $this->assertEquals($activityId, $result['id'], ' in line ' . __LINE__); @@ -986,7 +952,6 @@ class api_v3_ActivityTest extends CiviUnitTestCase { 'return.assignee_contact_id' => 1, 'return.target_contact_id' => 1, 'return.source_contact_id' => 1, - 'version' => 3, 'id' => $result['id'] ) ); @@ -1000,10 +965,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase { $this->assertEquals(TRUE, in_array($contact4, $target), ' in line ' . __LINE__); foreach ($this->_params as $fld => $val) { - if ($fld == 'version') { - continue; - } - $this->assertEquals($val, $result['values'][$result['id']][$fld], ' in line ' . __LINE__); + $this->assertEquals($val, $result['values'][$result['id']][$fld]); } } @@ -1023,11 +985,9 @@ class api_v3_ActivityTest extends CiviUnitTestCase { 'status_id' => 1, 'source_contact_id' => $this->_contactID, 'priority_id' => 1, - 'version' => $this->_apiversion, ); $result = $this->callAPISuccess('activity', 'create', $params); - $this->assertAPISuccess($result, 'in line ' . __LINE__); //hack on date comparison - really we should make getAndCheck smarter to handle dates $params['activity_date_time'] = $this->_params['activity_date_time']; // we also unset source_contact_id since it is stored in an aux table @@ -1040,27 +1000,18 @@ class api_v3_ActivityTest extends CiviUnitTestCase { */ function testActivityUpdateWithStatus() { $activity = $this->callAPISuccess('activity', 'create', $this->_params); - $this->assertAPISuccess($activity, "In line " . __LINE__); $params = array( 'id' => $activity['id'], 'source_contact_id' => $this->_contactID, 'subject' => 'Hurry update works', 'status_id' => 1, 'activity_name' => 'Test activity type', - 'version' => $this->_apiversion, ); $result = $this->callAPISuccess('activity', 'create', $params); - $this->assertAPISuccess($result, "In line " . __LINE__); - $this->assertEquals($result['id'], $activity['id'], "In line " . __LINE__); - /*$this->assertEquals($result['values'][$activity['id']]['source_contact_id'], $this->_contactID, - "In line " . __LINE__ - );*/ - $this->assertEquals($result['values'][$activity['id']]['subject'], 'Hurry update works', - "In line " . __LINE__ - ); - $this->assertEquals($result['values'][$activity['id']]['status_id'], 1, - "In line " . __LINE__ + $this->assertEquals($result['id'], $activity['id']); + $this->assertEquals($result['values'][$activity['id']]['subject'], 'Hurry update works'); + $this->assertEquals($result['values'][$activity['id']]['status_id'], 1 ); } @@ -1081,14 +1032,10 @@ class api_v3_ActivityTest extends CiviUnitTestCase { 'status_id' => 1, 'activity_name' => 'Test activity type', 'priority_id' => 1, - 'version' => $this->_apiversion, ); $result = $this->callAPISuccess('activity', 'create', $params); - $this->assertAPISuccess($result, 'in line ' . __LINE__); - $findactivity = $this->callAPISuccess('Activity', 'Get', array('id' => $activity['id'], 'version' => 3)); - - $this->assertAPISuccess($findactivity); + $findactivity = $this->callAPISuccess('Activity', 'Get', array('id' => $activity['id'])); } /** @@ -1127,7 +1074,6 @@ class api_v3_ActivityTest extends CiviUnitTestCase { )); $result = $this->callAPISuccess('Activity', 'Get', array( - 'version' => 3, 'id' => $activity['id'], 'return.assignee_contact_id' => 1, 'api.contact.get' => array('api.pledge.get' => 1), @@ -1163,8 +1109,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase { function testGetFields() { $params = array('action' => 'create'); - $result = $this->callAPISuccess('activity', 'getfields', $params); - $this->documentMe($params, $result, __FUNCTION__, __FILE__, NULL, NULL, 'getfields'); + $result = $this->callAPIAndDocument('activity', 'getfields', $params, __FUNCTION__, __FILE__, NULL, NULL, 'getfields'); $this->assertTrue(is_array($result['values']), 'get fields doesnt return values array in line ' . __LINE__); // $this->assertTrue(is_array($result['values']['priority_id']['options'])); foreach ($result['values'] as $key => $value) { diff --git a/tests/phpunit/api/v3/EventTest.php b/tests/phpunit/api/v3/EventTest.php index c97a56e82b..4e72d23243 100644 --- a/tests/phpunit/api/v3/EventTest.php +++ b/tests/phpunit/api/v3/EventTest.php @@ -196,8 +196,8 @@ class api_v3_EventTest extends CiviUnitTestCase { $description = "demonstrates use of is.Current option"; $subfile = "IsCurrentOption"; $result = $this->callAPIAndDocument('Event', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile); - $allEvents = $this->callAPISuccess('Event', 'Get', array('version' => 3)); - $this->callAPISuccess('Event', 'Delete', array('version' => 3, 'id' => $currentEvent['id'])); + $allEvents = $this->callAPISuccess('Event', 'Get', array()); + $this->callAPISuccess('Event', 'Delete', array('id' => $currentEvent['id'])); $this->assertEquals(1, $result['count'], 'confirm only one event found in line ' . __LINE__); $this->assertEquals(3, $allEvents['count'], 'confirm three events exist (ie. two not found) ' . __LINE__); $this->assertEquals($currentEvent['id'], $result['id'], ''); diff --git a/tests/phpunit/api/v3/MailingGroupTest.php b/tests/phpunit/api/v3/MailingGroupTest.php index bd20a11c52..6c84dece11 100644 --- a/tests/phpunit/api/v3/MailingGroupTest.php +++ b/tests/phpunit/api/v3/MailingGroupTest.php @@ -91,7 +91,8 @@ class api_v3_MailingGroupTest extends CiviUnitTestCase { $params = array( 'email' => $this->_email, 'group_id' => $this->_groupID, - 'contact_id' => $contactID, 'hash' => 'b15de8b64e2cec34', + 'contact_id' => $contactID, + 'hash' => 'b15de8b64e2cec34', 'time_stamp' => '20101212121212', ); $result = $this->callAPIAndDocument('mailing_event_subscribe', 'create', $params, __FUNCTION__, __FILE__); -- 2.25.1