}
/**
- * Get camel case version of entity or action name.
+ * Get camel case version of entity name.
*
* @param string|null $entity
*
<?php
/**
- * Test Generated example of using activity Create API.
+ * Test Generated example demonstrating the Activity.create API.
*
* Demonstrates create with Contact Reference Custom Field.
*
);
try{
- $result = civicrm_api3('activity', 'Create', $params);
+ $result = civicrm_api3('Activity', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testActivityCreateCustomContactRefField
-* and can be found in
+* The test that created it is called "testActivityCreateCustomContactRefField"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using activity get API.
+ * Test Generated example demonstrating the Activity.get API.
*
* Get with Contact Ref Custom Field
*
);
try{
- $result = civicrm_api3('activity', 'get', $params);
+ $result = civicrm_api3('Activity', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testActivityCreateCustomContactRefField
-* and can be found in
+* The test that created it is called "testActivityCreateCustomContactRefField"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using activity create API.
+ * Test Generated example demonstrating the Activity.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('activity', 'create', $params);
+ $result = civicrm_api3('Activity', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testActivityCreateCustom
-* and can be found in
+* The test that created it is called "testActivityCreateCustom"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using activity get API.
+ * Test Generated example demonstrating the Activity.get API.
*
* Demonstrates _high filter (at time of writing doesn't work if contact_id is set.
*
);
try{
- $result = civicrm_api3('activity', 'get', $params);
+ $result = civicrm_api3('Activity', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetFilterMaxDate
-* and can be found in
+* The test that created it is called "testGetFilterMaxDate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using activity get API.
+ * Test Generated example demonstrating the Activity.get API.
*
* Demonstrates _low filter (at time of writing doesn't work if contact_id is set.
*
);
try{
- $result = civicrm_api3('activity', 'get', $params);
+ $result = civicrm_api3('Activity', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetFilterMaxDate
-* and can be found in
+* The test that created it is called "testGetFilterMaxDate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using activity delete API.
+ * Test Generated example demonstrating the Activity.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('activity', 'delete', $params);
+ $result = civicrm_api3('Activity', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteActivity
-* and can be found in
+* The test that created it is called "testDeleteActivity"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using activity get API.
+ * Test Generated example demonstrating the Activity.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('activity', 'get', $params);
+ $result = civicrm_api3('Activity', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testActivityGetContact_idCustom
-* and can be found in
+* The test that created it is called "testActivityGetContact_idCustom"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using activity getfields API.
+ * Test Generated example demonstrating the Activity.getfields API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('activity', 'getfields', $params);
+ $result = civicrm_api3('Activity', 'getfields', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetFields
-* and can be found in
+* The test that created it is called "testGetFields"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using activity API.
+ * Test Generated example demonstrating the Activity.create API.
*
* Demonstrates setting & retrieving activity target & source.
*
* @return array
* API result array
*/
-function activity__example() {
+function activity_create_example() {
$params = array(
'source_contact_id' => 1,
'subject' => 'Make-it-Happen Meeting',
);
try{
- $result = civicrm_api3('activity', '', $params);
+ $result = civicrm_api3('Activity', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
* @return array
* API result array
*/
-function activity__expectedresult() {
+function activity_create_expectedresult() {
$expectedResult = array(
'is_error' => 0,
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testActivityReturnTargetAssignee
-* and can be found in
+* The test that created it is called "testActivityReturnTargetAssignee"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using activity get API.
+ * Test Generated example demonstrating the Activity.get API.
*
- * Demonstrates getting asignee_contact_id & using it to get the contact.
+ * Demonstrates getting assignee_contact_id & using it to get the contact.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('activity', 'get', $params);
+ $result = civicrm_api3('Activity', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testActivityGetGoodID1
-* and can be found in
+* The test that created it is called "testActivityGetGoodID1"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using activity_contact create API.
+ * Test Generated example demonstrating the ActivityContact.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('activity_contact', 'create', $params);
+ $result = civicrm_api3('ActivityContact', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateActivityContact
-* and can be found in
+* The test that created it is called "testCreateActivityContact"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using activity_contact delete API.
+ * Test Generated example demonstrating the ActivityContact.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('activity_contact', 'delete', $params);
+ $result = civicrm_api3('ActivityContact', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteActivityContact
-* and can be found in
+* The test that created it is called "testDeleteActivityContact"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using activity_type create API.
+ * Test Generated example demonstrating the ActivityType.create API.
*
* @deprecated
- * The activity_type api is deprecated. Please use the option_value api instead.
+ * The ActivityType api is deprecated. Please use the OptionValue api instead.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('activity_type', 'create', $params);
+ $result = civicrm_api3('ActivityType', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
'visibility_id' => '',
),
),
- 'deprecated' => 'The activity_type api is deprecated. Please use the option_value api instead.',
+ 'deprecated' => 'The ActivityType api is deprecated. Please use the OptionValue api instead.',
);
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testActivityTypeCreate
-* and can be found in
+* The test that created it is called "testActivityTypeCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTypeTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using activity_type get API.
+ * Test Generated example demonstrating the ActivityType.get API.
*
* @deprecated
- * The activity_type api is deprecated. Please use the option_value api instead.
+ * The ActivityType api is deprecated. Please use the OptionValue api instead.
*
* @return array
* API result array
$params = array();
try{
- $result = civicrm_api3('activity_type', 'get', $params);
+ $result = civicrm_api3('ActivityType', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
'49' => 'Downloaded Invoice',
'50' => 'Emailed Invoice',
),
- 'deprecated' => 'The activity_type api is deprecated. Please use the option_value api instead.',
+ 'deprecated' => 'The ActivityType api is deprecated. Please use the OptionValue api instead.',
);
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testActivityTypeGet
-* and can be found in
+* The test that created it is called "testActivityTypeGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTypeTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using address get API.
+ * Test Generated example demonstrating the Address.get API.
*
* Demonstrates Use of Like.
*
);
try{
- $result = civicrm_api3('address', 'get', $params);
+ $result = civicrm_api3('Address', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetAddressLikeSuccess
-* and can be found in
+* The test that created it is called "testGetAddressLikeSuccess"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using address create API.
+ * Test Generated example demonstrating the Address.create API.
*
* Demonstrates Use of address parsing param.
*
);
try{
- $result = civicrm_api3('address', 'create', $params);
+ $result = civicrm_api3('Address', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateAddressParsing
-* and can be found in
+* The test that created it is called "testCreateAddressParsing"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using address get API.
+ * Test Generated example demonstrating the Address.get API.
*
* Demonstrates Use of sort filter.
*
);
try{
- $result = civicrm_api3('address', 'get', $params);
+ $result = civicrm_api3('Address', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetAddressSort
-* and can be found in
+* The test that created it is called "testGetAddressSort"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using address create API.
+ * Test Generated example demonstrating the Address.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('address', 'create', $params);
+ $result = civicrm_api3('Address', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateAddress
-* and can be found in
+* The test that created it is called "testCreateAddress"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using address delete API.
+ * Test Generated example demonstrating the Address.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('address', 'delete', $params);
+ $result = civicrm_api3('Address', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteAddress
-* and can be found in
+* The test that created it is called "testDeleteAddress"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using address get API.
+ * Test Generated example demonstrating the Address.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('address', 'get', $params);
+ $result = civicrm_api3('Address', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetAddress
-* and can be found in
+* The test that created it is called "testGetAddress"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php
*
* You can see the outcome of the API tests at
--- /dev/null
+<?php
+/**
+ * Test Generated example demonstrating the Address.getoptions API.
+ *
+ * @return array
+ * API result array
+ */
+function address_getoptions_example() {
+ $params = array(
+ 'field' => 'location_type_id',
+ );
+
+ try{
+ $result = civicrm_api3('Address', 'getoptions', $params);
+ }
+ catch (CiviCRM_API3_Exception $e) {
+ // Handle error here.
+ $errorMessage = $e->getMessage();
+ $errorCode = $e->getErrorCode();
+ $errorData = $e->getExtraParams();
+ return array(
+ 'error' => $errorMessage,
+ 'error_code' => $errorCode,
+ 'error_data' => $errorData,
+ );
+ }
+
+ return $result;
+}
+
+/**
+ * Function returns array of result expected from previous function.
+ *
+ * @return array
+ * API result array
+ */
+function address_getoptions_expectedresult() {
+
+ $expectedResult = array(
+ 'is_error' => 0,
+ 'version' => 3,
+ 'count' => 5,
+ 'values' => array(
+ '5' => 'Billing',
+ '1' => 'Home',
+ '3' => 'Main',
+ '4' => 'Other',
+ '2' => 'Work',
+ ),
+ );
+
+ return $expectedResult;
+}
+
+/*
+* This example has been generated from the API test suite.
+* The test that created it is called "testLocationTypeGet"
+* and can be found at:
+* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ConstantTest.php
+*
+* You can see the outcome of the API tests at
+* https://test.civicrm.org/job/CiviCRM-master-git/
+*
+* To Learn about the API read
+* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
+*
+* Browse the api on your own site with the api explorer
+* http://MYSITE.ORG/path/to/civicrm/api
+*
+* Read more about testing here
+* http://wiki.civicrm.org/confluence/display/CRM/Testing
+*
+* API Standards documentation:
+* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
+*/
<?php
/**
- * Test Generated example of using batch create API.
+ * Test Generated example demonstrating the Batch.create API.
*
* @return array
* API result array
*/
function batch_create_example() {
$params = array(
- 'name' => 'New_Batch_03',
- 'title' => 'New Batch 03',
- 'description' => 'This is description for New Batch 03',
- 'total' => '300.33',
- 'item_count' => 3,
- 'status_id' => 1,
+ 'name' => 'New_Batch_04',
+ 'title' => 'New Batch 04',
+ 'description' => 'This is description for New Batch 04',
+ 'total' => '400.44',
+ 'item_count' => 4,
+ 'id' => 3,
);
try{
- $result = civicrm_api3('batch', 'create', $params);
+ $result = civicrm_api3('Batch', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'id' => 2,
+ 'id' => 3,
'values' => array(
- '2' => array(
- 'id' => '2',
- 'name' => 'New_Batch_03',
- 'title' => 'New Batch 03',
- 'description' => 'This is description for New Batch 03',
+ '3' => array(
+ 'id' => '3',
+ 'name' => 'New_Batch_04',
+ 'title' => 'New Batch 04',
+ 'description' => 'This is description for New Batch 04',
'created_id' => '',
'created_date' => '',
'modified_id' => '',
- 'modified_date' => '2012-11-14 16:02:35',
+ 'modified_date' => '',
'saved_search_id' => '',
- 'status_id' => '1',
+ 'status_id' => '',
'type_id' => '',
'mode_id' => '',
- 'total' => '300.33',
- 'item_count' => '3',
+ 'total' => '400.44',
+ 'item_count' => '4',
'payment_instrument_id' => '',
'exported_date' => '',
'data' => '',
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreate
-* and can be found in
+* The test that created it is called "testUpdate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/BatchTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using batch delete API.
+ * Test Generated example demonstrating the Batch.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('batch', 'delete', $params);
+ $result = civicrm_api3('Batch', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testBatchDeleteCorrectSyntax
-* and can be found in
+* The test that created it is called "testBatchDeleteCorrectSyntax"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/BatchTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using batch get API.
+ * Test Generated example demonstrating the Batch.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('batch', 'get', $params);
+ $result = civicrm_api3('Batch', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGet
-* and can be found in
+* The test that created it is called "testGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/BatchTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using campaign create API.
+ * Test Generated example demonstrating the Campaign.create API.
*
* Create a campaign - Note use of relative dates here:
* @link http://www.php.net/manual/en/datetime.formats.relative.php.
);
try{
- $result = civicrm_api3('campaign', 'create', $params);
+ $result = civicrm_api3('Campaign', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateCampaign
-* and can be found in
+* The test that created it is called "testCreateCampaign"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CampaignTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using campaign delete API.
+ * Test Generated example demonstrating the Campaign.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('campaign', 'delete', $params);
+ $result = civicrm_api3('Campaign', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteCampaign
-* and can be found in
+* The test that created it is called "testDeleteCampaign"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CampaignTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using campaign get API.
+ * Test Generated example demonstrating the Campaign.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('campaign', 'get', $params);
+ $result = civicrm_api3('Campaign', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetCampaign
-* and can be found in
+* The test that created it is called "testGetCampaign"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CampaignTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using case create API.
+ * Test Generated example demonstrating the Case.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('case', 'create', $params);
+ $result = civicrm_api3('Case', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCaseCreate
-* and can be found in
+* The test that created it is called "testCaseCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CaseTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using constant get API.
+ * Test Generated example demonstrating the Constant.get API.
*
* @deprecated
- * The constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.
+ * The Constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('constant', 'get', $params);
+ $result = civicrm_api3('Constant', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
'49' => 'Downloaded Invoice',
'50' => 'Emailed Invoice',
),
- 'deprecated' => 'The constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.',
+ 'deprecated' => 'The Constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.',
);
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testActivityType
-* and can be found in
+* The test that created it is called "testActivityType"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ConstantTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact get API.
+ * Test Generated example demonstrating the Contact.get API.
*
* This demonstrates the usage of chained api functions.
* In this case no notes or custom fields have been created.
);
try{
- $result = civicrm_api3('contact', 'get', $params);
+ $result = civicrm_api3('Contact', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetIndividualWithChainedArrays
-* and can be found in
+* The test that created it is called "testGetIndividualWithChainedArrays"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact get API.
+ * Test Generated example demonstrating the Contact.get API.
*
* This demonstrates the usage of chained api functions.
* In this case no notes or custom fields have been created.
);
try{
- $result = civicrm_api3('contact', 'get', $params);
+ $result = civicrm_api3('Contact', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetIndividualWithChainedArraysFormats
-* and can be found in
+* The test that created it is called "testGetIndividualWithChainedArraysFormats"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact get API.
+ * Test Generated example demonstrating the Contact.get API.
*
* This demonstrates the usage of chained api functions with multiple custom fields.
*
);
try{
- $result = civicrm_api3('contact', 'get', $params);
+ $result = civicrm_api3('Contact', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetIndividualWithChainedArraysAndMultipleCustom
-* and can be found in
+* The test that created it is called "testGetIndividualWithChainedArraysAndMultipleCustom"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact create API.
+ * Test Generated example demonstrating the Contact.create API.
*
* This demonstrates the usage of chained api functions. Specifically it has one 'parent function' &
* 2 child functions - one receives values from the parent (Contact) and the other child (Tag).
);
try{
- $result = civicrm_api3('contact', 'create', $params);
+ $result = civicrm_api3('Contact', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testChainingValuesCreate
-* and can be found in
+* The test that created it is called "testChainingValuesCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact create API.
+ * Test Generated example demonstrating the Contact.create API.
*
* This demonstrates the syntax to create 2 chained entities.
*
);
try{
- $result = civicrm_api3('contact', 'create', $params);
+ $result = civicrm_api3('Contact', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateIndividualWithContributionDottedSyntax
-* and can be found in
+* The test that created it is called "testCreateIndividualWithContributionDottedSyntax"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact create API.
+ * Test Generated example demonstrating the Contact.create API.
*
* Demonstrates creating two websites as an array.
*
);
try{
- $result = civicrm_api3('contact', 'create', $params);
+ $result = civicrm_api3('Contact', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateIndividualWithContributionChainedArrays
-* and can be found in
+* The test that created it is called "testCreateIndividualWithContributionChainedArrays"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact create API.
+ * Test Generated example demonstrating the Contact.create API.
*
* This demonstrates setting a custom field through the API.
*
);
try{
- $result = civicrm_api3('contact', 'create', $params);
+ $result = civicrm_api3('Contact', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateWithCustom
-* and can be found in
+* The test that created it is called "testCreateWithCustom"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using participant create API.
+ * Test Generated example demonstrating the Contact.create API.
*
* Single function to create contact with partipation & contribution.
* Note that in the case of 'contribution' the 'create' is implied (api.contribution.create)
* @return array
* API result array
*/
-function participant_create_example() {
+function contact_create_example() {
$params = array(
'contact_type' => 'Individual',
'display_name' => 'dlobo',
);
try{
- $result = civicrm_api3('participant', 'create', $params);
+ $result = civicrm_api3('Contact', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
* @return array
* API result array
*/
-function participant_create_expectedresult() {
+function contact_create_expectedresult() {
$expectedResult = array(
'is_error' => 0,
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateParticipantWithPayment
-* and can be found in
+* The test that created it is called "testCreateParticipantWithPayment"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact get API.
+ * Test Generated example demonstrating the Contact.get API.
*
* This demonstrates setting a custom field through the API.
*
);
try{
- $result = civicrm_api3('contact', 'get', $params);
+ $result = civicrm_api3('Contact', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetWithCustom
-* and can be found in
+* The test that created it is called "testGetWithCustom"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact get API.
+ * Test Generated example demonstrating the Contact.get API.
*
* This demonstrates setting a custom field through the API.
*
);
try{
- $result = civicrm_api3('contact', 'get', $params);
+ $result = civicrm_api3('Contact', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetWithCustomReturnSyntax
-* and can be found in
+* The test that created it is called "testGetWithCustomReturnSyntax"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact delete API.
+ * Test Generated example demonstrating the Contact.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('contact', 'delete', $params);
+ $result = civicrm_api3('Contact', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testContactDelete
-* and can be found in
+* The test that created it is called "testContactDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact create API.
+ * Test Generated example demonstrating the Contact.create API.
*
* This demonstrates use of the 'format.is_success' param.
* This param causes only the success or otherwise of the function to be returned as BOOLEAN
);
try{
- $result = civicrm_api3('contact', 'create', $params);
+ $result = civicrm_api3('Contact', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testContactCreateFormatIsSuccessFalse
-* and can be found in
+* The test that created it is called "testContactCreateFormatIsSuccessFalse"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact get API.
+ * Test Generated example demonstrating the Contact.get API.
*
* This demonstrates use of the 'format.is_success' param.
* This param causes only the success or otherwise of the function to be returned as BOOLEAN
);
try{
- $result = civicrm_api3('contact', 'get', $params);
+ $result = civicrm_api3('Contact', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testContactGetFormatIsSuccessTrue
-* and can be found in
+* The test that created it is called "testContactGetFormatIsSuccessTrue"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact get API.
+ * Test Generated example demonstrating the Contact.get API.
*
* This demonstrates use of the 'format.id_only' param.
* This param causes the id of the only entity to be returned as an integer.
);
try{
- $result = civicrm_api3('contact', 'get', $params);
+ $result = civicrm_api3('Contact', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testContactGetFormatIDOnly
-* and can be found in
+* The test that created it is called "testContactGetFormatIDOnly"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact getvalue API.
+ * Test Generated example demonstrating the Contact.getvalue API.
*
* This demonstrates use of the 'format.single_value' param.
* This param causes only a single value of the only entity to be returned as an string.
);
try{
- $result = civicrm_api3('contact', 'getvalue', $params);
+ $result = civicrm_api3('Contact', 'getvalue', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testContactGetFormatSingleValue
-* and can be found in
+* The test that created it is called "testContactGetFormatSingleValue"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact get API.
+ * Test Generated example demonstrating the Contact.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('contact', 'get', $params);
+ $result = civicrm_api3('Contact', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testContactGetEmail
-* and can be found in
+* The test that created it is called "testContactGetEmail"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact getactions API.
+ * Test Generated example demonstrating the Contact.getactions API.
*
* Getting the available actions for an entity.
*
$params = array();
try{
- $result = civicrm_api3('contact', 'getactions', $params);
+ $result = civicrm_api3('Contact', 'getactions', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
$expectedResult = array(
'is_error' => 0,
'version' => 3,
- 'count' => 18,
+ 'count' => 23,
'values' => array(
'0' => 'create',
'1' => 'delete',
- '2' => 'get',
- '3' => 'getactions',
- '4' => 'getcount',
- '5' => 'getfields',
- '6' => 'getlist',
- '7' => 'getoptions',
- '8' => 'getquick',
- '9' => 'getrefcount',
- '10' => 'getsingle',
- '11' => 'getstat',
- '12' => 'getvalue',
- '13' => 'merge',
- '14' => 'proximity',
- '15' => 'replace',
- '16' => 'setvalue',
- '17' => 'update',
+ '2' => 'example_action1',
+ '3' => 'example_action2',
+ '4' => 'get',
+ '5' => 'getactions',
+ '6' => 'getcount',
+ '7' => 'getfields',
+ '8' => 'getlist',
+ '9' => 'getoptions',
+ '10' => 'getquick',
+ '11' => 'getrefcount',
+ '12' => 'getsingle',
+ '13' => 'getstat',
+ '14' => 'getvalue',
+ '15' => 'merge',
+ '16' => 'proximity',
+ '17' => 'replace',
+ '18' => 'setvalue',
+ '19' => 'type_create',
+ '20' => 'type_delete',
+ '21' => 'type_get',
+ '22' => 'update',
),
'deprecated' => array(
'getquick' => 'The "getquick" action is deprecated in favor of "getlist".',
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetActions
-* and can be found in
+* The test that created it is called "testGetActions"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact getcount API.
+ * Test Generated example demonstrating the Contact.getcount API.
*
* This demonstrates use of the 'getCount' action.
* This param causes the count of the only function to be returned as an integer.
);
try{
- $result = civicrm_api3('contact', 'getcount', $params);
+ $result = civicrm_api3('Contact', 'getcount', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testContactGetFormatCountOnly
-* and can be found in
+* The test that created it is called "testContactGetFormatCountOnly"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact GetFields API.
+ * Test Generated example demonstrating the Contact.getfields API.
*
* Demonstrates retrieving metadata with custom field options.
*
);
try{
- $result = civicrm_api3('contact', 'GetFields', $params);
+ $result = civicrm_api3('Contact', 'getfields', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCustomFieldCreateWithOptionValues
-* and can be found in
+* The test that created it is called "testCustomFieldCreateWithOptionValues"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact getoptions API.
+ * Test Generated example demonstrating the Contact.getoptions API.
*
* Demonstrates retrieving options for a custom field.
*
);
try{
- $result = civicrm_api3('contact', 'getoptions', $params);
+ $result = civicrm_api3('Contact', 'getoptions', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCustomFieldCreateWithOptionValues
-* and can be found in
+* The test that created it is called "testCustomFieldCreateWithOptionValues"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact getsingle API.
+ * Test Generated example demonstrating the Contact.getsingle API.
*
* This demonstrates use of the 'format.single_entity_array' param.
* This param causes the only contact to be returned as an array without the other levels.
);
try{
- $result = civicrm_api3('contact', 'getsingle', $params);
+ $result = civicrm_api3('Contact', 'getsingle', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testContactGetSingleEntityArray
-* and can be found in
+* The test that created it is called "testContactGetSingleEntityArray"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contact get API.
+ * Test Generated example demonstrating the Contact.get API.
*
* Get all from group and display contacts.
*
);
try{
- $result = civicrm_api3('contact', 'get', $params);
+ $result = civicrm_api3('Contact', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetGroupIDFromContact
-* and can be found in
+* The test that created it is called "testGetGroupIDFromContact"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using email replace API.
+ * Test Generated example demonstrating the Contact.get API.
*
* Demonstrates use of Replace in a nested API call.
*
* @return array
* API result array
*/
-function email_replace_example() {
+function contact_get_example() {
$params = array(
'id' => 10,
'api.email.replace' => array(
);
try{
- $result = civicrm_api3('email', 'replace', $params);
+ $result = civicrm_api3('Contact', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
* @return array
* API result array
*/
-function email_replace_expectedresult() {
+function contact_get_expectedresult() {
$expectedResult = array(
'is_error' => 0,
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testReplaceEmailsInChain
-* and can be found in
+* The test that created it is called "testReplaceEmailsInChain"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EmailTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contribution create API.
+ * Test Generated example demonstrating the Contribution.create API.
*
* Demonstrates creating contribution with Soft Credit by passing in honor_contact_id.
*
);
try{
- $result = civicrm_api3('contribution', 'create', $params);
+ $result = civicrm_api3('Contribution', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateContributionWithHonoreeContact
-* and can be found in
+* The test that created it is called "testCreateContributionWithHonoreeContact"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contribution create API.
+ * Test Generated example demonstrating the Contribution.create API.
*
* Demonstrates creating contribution with Note Entity.
*
);
try{
- $result = civicrm_api3('contribution', 'create', $params);
+ $result = civicrm_api3('Contribution', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateContributionWithNote
-* and can be found in
+* The test that created it is called "testCreateContributionWithNote"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contribution create API.
+ * Test Generated example demonstrating the Contribution.create API.
*
* Demonstrates creating contribution with SoftCredit.
*
);
try{
- $result = civicrm_api3('contribution', 'create', $params);
+ $result = civicrm_api3('Contribution', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateContributionWithSoftCredit
-* and can be found in
+* The test that created it is called "testCreateContributionWithSoftCredit"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contribution create API.
+ * Test Generated example demonstrating the Contribution.create API.
*
* Demonstrates creating contribution with Soft Credit defaults for amount and type.
*
);
try{
- $result = civicrm_api3('contribution', 'create', $params);
+ $result = civicrm_api3('Contribution', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateContributionWithSoftCreditDefaults
-* and can be found in
+* The test that created it is called "testCreateContributionWithSoftCreditDefaults"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contribution create API.
+ * Test Generated example demonstrating the Contribution.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('contribution', 'create', $params);
+ $result = civicrm_api3('Contribution', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateContributionPendingOnline
-* and can be found in
-* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php
+* The test that created it is called "testCreateContributionPendingOnline"
+* and can be found at:
+* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TaxContributionPageTest.php
*
* You can see the outcome of the API tests at
* https://test.civicrm.org/job/CiviCRM-master-git/
<?php
/**
- * Test Generated example of using contribution create API.
+ * Test Generated example demonstrating the Contribution.create API.
*
* Create Contribution with Nested Line Items.
*
*/
function contribution_create_example() {
$params = array(
- 'contact_id' => 9,
+ 'contact_id' => 1,
'receive_date' => '20120511',
- 'total_amount' => '100',
- 'financial_type_id' => 1,
- 'payment_instrument_id' => 1,
- 'non_deductible_amount' => '10',
- 'fee_amount' => '50',
- 'net_amount' => '90',
+ 'total_amount' => '400',
+ 'financial_type_id' => 7,
'trxn_id' => 12345,
'invoice_id' => 67890,
'source' => 'SSF',
'skipLineItem' => 1,
'api.line_item.create' => array(
'0' => array(
- 'price_field_id' => 1,
- 'qty' => 2,
- 'line_total' => '20',
- 'unit_price' => '10',
+ 'price_field_id' => array(
+ '0' => 3,
+ ),
+ 'qty' => 1,
+ 'line_total' => '100',
+ 'unit_price' => '100',
+ 'financial_type_id' => 7,
),
'1' => array(
- 'price_field_id' => 1,
+ 'price_field_id' => array(
+ '0' => 3,
+ ),
'qty' => 1,
- 'line_total' => '80',
- 'unit_price' => '80',
+ 'line_total' => '300',
+ 'unit_price' => '300',
+ 'financial_type_id' => 8,
),
),
);
try{
- $result = civicrm_api3('contribution', 'create', $params);
+ $result = civicrm_api3('Contribution', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
'values' => array(
'1' => array(
'id' => '1',
- 'contact_id' => '9',
- 'financial_type_id' => '1',
+ 'contact_id' => '1',
+ 'financial_type_id' => '7',
'contribution_page_id' => '',
- 'payment_instrument_id' => '1',
+ 'payment_instrument_id' => '4',
'receive_date' => '20120511000000',
- 'non_deductible_amount' => '10',
- 'total_amount' => '100',
- 'fee_amount' => '50',
- 'net_amount' => '90',
+ 'non_deductible_amount' => '',
+ 'total_amount' => '435',
+ 'fee_amount' => 0,
+ 'net_amount' => '435',
'trxn_id' => '12345',
'invoice_id' => '67890',
'currency' => 'USD',
'check_number' => '',
'campaign_id' => '',
'creditnote_id' => '',
- 'tax_amount' => 0,
- 'contribution_type_id' => '1',
+ 'tax_amount' => '35',
+ 'contribution_type_id' => '7',
'api.line_item.create' => array(
'0' => array(
'is_error' => 0,
'entity_table' => 'civicrm_contribution',
'entity_id' => '1',
'contribution_id' => '1',
- 'price_field_id' => '1',
+ 'price_field_id' => array(
+ '0' => '3',
+ ),
'label' => 'line item',
- 'qty' => '2',
- 'unit_price' => '10',
- 'line_total' => '20',
+ 'qty' => '1',
+ 'unit_price' => '100',
+ 'line_total' => '100',
'participant_count' => '',
'price_field_value_id' => '',
- 'financial_type_id' => '',
+ 'financial_type_id' => '7',
'deductible_amount' => '',
- 'tax_amount' => '',
+ 'tax_amount' => '20',
),
),
),
'entity_table' => 'civicrm_contribution',
'entity_id' => '1',
'contribution_id' => '1',
- 'price_field_id' => '1',
+ 'price_field_id' => array(
+ '0' => '3',
+ ),
'label' => 'line item',
'qty' => '1',
- 'unit_price' => '80',
- 'line_total' => '80',
+ 'unit_price' => '300',
+ 'line_total' => '300',
'participant_count' => '',
'price_field_value_id' => '',
- 'financial_type_id' => '',
+ 'financial_type_id' => '8',
'deductible_amount' => '',
- 'tax_amount' => '',
+ 'tax_amount' => '15',
),
),
),
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateContributionChainedLineItems
-* and can be found in
-* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php
+* The test that created it is called "testCreateContributionChainedLineItems"
+* and can be found at:
+* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TaxContributionPageTest.php
*
* You can see the outcome of the API tests at
* https://test.civicrm.org/job/CiviCRM-master-git/
<?php
/**
- * Test Generated example of using contribution delete API.
+ * Test Generated example demonstrating the Contribution.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('contribution', 'delete', $params);
+ $result = civicrm_api3('Contribution', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteContribution
-* and can be found in
-* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php
+* The test that created it is called "testDeleteContribution"
+* and can be found at:
+* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TaxContributionPageTest.php
*
* You can see the outcome of the API tests at
* https://test.civicrm.org/job/CiviCRM-master-git/
<?php
/**
- * Test Generated example of using contribution get API.
+ * Test Generated example demonstrating the Contribution.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('contribution', 'get', $params);
+ $result = civicrm_api3('Contribution', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetContributionLegacyBehaviour
-* and can be found in
+* The test that created it is called "testGetContributionLegacyBehaviour"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contribution_page create API.
+ * Test Generated example demonstrating the ContributionPage.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('contribution_page', 'create', $params);
+ $result = civicrm_api3('ContributionPage', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateContributionPage
-* and can be found in
+* The test that created it is called "testCreateContributionPage"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contribution_page delete API.
+ * Test Generated example demonstrating the ContributionPage.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('contribution_page', 'delete', $params);
+ $result = civicrm_api3('ContributionPage', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteContributionPage
-* and can be found in
+* The test that created it is called "testDeleteContributionPage"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contribution_page get API.
+ * Test Generated example demonstrating the ContributionPage.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('contribution_page', 'get', $params);
+ $result = civicrm_api3('ContributionPage', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetContributionPageByAmount
-* and can be found in
+* The test that created it is called "testGetContributionPageByAmount"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contribution_page Submit API.
+ * Test Generated example demonstrating the ContributionPage.submit API.
*
* submit contribution page
*
);
try{
- $result = civicrm_api3('contribution_page', 'Submit', $params);
+ $result = civicrm_api3('ContributionPage', 'submit', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testSubmitMembershipPriceSetPaymentPaymentProcessorRecurDelayed
-* and can be found in
+* The test that created it is called "testSubmitMembershipPriceSetPaymentPaymentProcessorRecurDelayed"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contribution_recur create API.
+ * Test Generated example demonstrating the ContributionRecur.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('contribution_recur', 'create', $params);
+ $result = civicrm_api3('ContributionRecur', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateContributionRecur
-* and can be found in
+* The test that created it is called "testCreateContributionRecur"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionRecurTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contribution_recur delete API.
+ * Test Generated example demonstrating the ContributionRecur.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('contribution_recur', 'delete', $params);
+ $result = civicrm_api3('ContributionRecur', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteContributionRecur
-* and can be found in
+* The test that created it is called "testDeleteContributionRecur"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionRecurTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contribution_recur get API.
+ * Test Generated example demonstrating the ContributionRecur.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('contribution_recur', 'get', $params);
+ $result = civicrm_api3('ContributionRecur', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetContributionRecur
-* and can be found in
+* The test that created it is called "testGetContributionRecur"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionRecurTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contribution_soft create API.
+ * Test Generated example demonstrating the ContributionSoft.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('contribution_soft', 'create', $params);
+ $result = civicrm_api3('ContributionSoft', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateContributionSoft
-* and can be found in
+* The test that created it is called "testCreateContributionSoft"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionSoftTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contribution_soft delete API.
+ * Test Generated example demonstrating the ContributionSoft.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('contribution_soft', 'delete', $params);
+ $result = civicrm_api3('ContributionSoft', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteContributionSoft
-* and can be found in
+* The test that created it is called "testDeleteContributionSoft"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionSoftTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using contribution_soft get API.
+ * Test Generated example demonstrating the ContributionSoft.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('contribution_soft', 'get', $params);
+ $result = civicrm_api3('ContributionSoft', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetContributionSoft
-* and can be found in
+* The test that created it is called "testGetContributionSoft"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionSoftTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using country create API.
+ * Test Generated example demonstrating the Country.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('country', 'create', $params);
+ $result = civicrm_api3('Country', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateCountry
-* and can be found in
+* The test that created it is called "testCreateCountry"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CountryTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using country delete API.
+ * Test Generated example demonstrating the Country.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('country', 'delete', $params);
+ $result = civicrm_api3('Country', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteCountry
-* and can be found in
+* The test that created it is called "testDeleteCountry"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CountryTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using country get API.
+ * Test Generated example demonstrating the Country.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('country', 'get', $params);
+ $result = civicrm_api3('Country', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGet
-* and can be found in
+* The test that created it is called "testGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CountryTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using custom_field create API.
+ * Test Generated example demonstrating the CustomField.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('custom_field', 'create', $params);
+ $result = civicrm_api3('CustomField', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCustomFieldCreateWithEdit
-* and can be found in
+* The test that created it is called "testCustomFieldCreateWithEdit"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomFieldTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using custom_field delete API.
+ * Test Generated example demonstrating the CustomField.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('custom_field', 'delete', $params);
+ $result = civicrm_api3('CustomField', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCustomFieldDelete
-* and can be found in
+* The test that created it is called "testCustomFieldDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomFieldTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using custom_group create API.
+ * Test Generated example demonstrating the CustomGroup.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('custom_group', 'create', $params);
+ $result = civicrm_api3('CustomGroup', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCustomGroupCreate
-* and can be found in
+* The test that created it is called "testCustomGroupCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomGroupTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using custom_group delete API.
+ * Test Generated example demonstrating the CustomGroup.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('custom_group', 'delete', $params);
+ $result = civicrm_api3('CustomGroup', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCustomGroupDelete
-* and can be found in
+* The test that created it is called "testCustomGroupDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomGroupTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using custom_group get API.
+ * Test Generated example demonstrating the CustomGroup.get API.
*
* @return array
* API result array
$params = array();
try{
- $result = civicrm_api3('custom_group', 'get', $params);
+ $result = civicrm_api3('CustomGroup', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetCustomGroupSuccess
-* and can be found in
+* The test that created it is called "testGetCustomGroupSuccess"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomGroupTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using custom_value create API.
+ * Test Generated example demonstrating the CustomValue.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('custom_value', 'create', $params);
+ $result = civicrm_api3('CustomValue', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateCustomValue
-* and can be found in
+* The test that created it is called "testCreateCustomValue"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomValueTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using custom_value get API.
+ * Test Generated example demonstrating the CustomValue.get API.
*
* utilises field names
*
);
try{
- $result = civicrm_api3('custom_value', 'get', $params);
+ $result = civicrm_api3('CustomValue', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetMultipleCustomValues
-* and can be found in
+* The test that created it is called "testGetMultipleCustomValues"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomValueTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using custom_value get API.
+ * Test Generated example demonstrating the CustomValue.get API.
*
* This demonstrates the use of CustomValue get to fetch single and multi-valued custom data.
*
);
try{
- $result = civicrm_api3('custom_value', 'get', $params);
+ $result = civicrm_api3('CustomValue', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetMultipleCustomValues
-* and can be found in
+* The test that created it is called "testGetMultipleCustomValues"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomValueTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using domain create API.
+ * Test Generated example demonstrating the Domain.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('domain', 'create', $params);
+ $result = civicrm_api3('Domain', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreate
-* and can be found in
+* The test that created it is called "testCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/DomainTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using domain get API.
+ * Test Generated example demonstrating the Domain.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('domain', 'get', $params);
+ $result = civicrm_api3('Domain', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGet
-* and can be found in
+* The test that created it is called "testGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/DomainTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using email create API.
+ * Test Generated example demonstrating the Email.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('email', 'create', $params);
+ $result = civicrm_api3('Email', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateEmail
-* and can be found in
+* The test that created it is called "testCreateEmail"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EmailTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using email delete API.
+ * Test Generated example demonstrating the Email.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('email', 'delete', $params);
+ $result = civicrm_api3('Email', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteEmail
-* and can be found in
+* The test that created it is called "testDeleteEmail"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EmailTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using email replace API.
+ * Test Generated example demonstrating the Email.replace API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('email', 'replace', $params);
+ $result = civicrm_api3('Email', 'replace', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testReplaceEmail
-* and can be found in
+* The test that created it is called "testReplaceEmail"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EmailTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using entity_tag create API.
+ * Test Generated example demonstrating the EntityTag.create API.
*
* @return array
* API result array
*/
function entity_tag_create_example() {
$params = array(
- 'contact_id' => 12,
- 'tag_id' => '9',
+ 'contact_id' => 3,
+ 'tag_id' => '6',
);
try{
- $result = civicrm_api3('entity_tag', 'create', $params);
+ $result = civicrm_api3('EntityTag', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testContactEntityTagCreate
-* and can be found in
+* The test that created it is called "testIndividualEntityTagGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EntityTagTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using entity_tag delete API.
+ * Test Generated example demonstrating the EntityTag.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('entity_tag', 'delete', $params);
+ $result = civicrm_api3('EntityTag', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testEntityTagDeleteHH
-* and can be found in
+* The test that created it is called "testEntityTagDeleteHH"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EntityTagTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using entity_tag get API.
+ * Test Generated example demonstrating the EntityTag.get API.
*
* @return array
* API result array
*/
function entity_tag_get_example() {
$params = array(
- 'contact_id' => 21,
- 'tag_id' => '12',
+ 'contact_id' => 3,
);
try{
- $result = civicrm_api3('entity_tag', 'get', $params);
+ $result = civicrm_api3('EntityTag', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
$expectedResult = array(
'is_error' => 0,
- 'not_added' => 0,
- 'added' => 1,
- 'total_count' => 1,
+ 'version' => 3,
+ 'count' => 1,
+ 'id' => 6,
+ 'values' => array(
+ '6' => array(
+ 'tag_id' => '6',
+ ),
+ ),
);
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testIndividualEntityTagGet
-* and can be found in
+* The test that created it is called "testIndividualEntityTagGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EntityTagTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using event create API.
+ * Test Generated example demonstrating the Event.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('event', 'create', $params);
+ $result = civicrm_api3('Event', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateEventSuccess
-* and can be found in
+* The test that created it is called "testCreateEventSuccess"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using event delete API.
+ * Test Generated example demonstrating the Event.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('event', 'delete', $params);
+ $result = civicrm_api3('Event', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDelete
-* and can be found in
+* The test that created it is called "testDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using event get API.
+ * Test Generated example demonstrating the Event.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('event', 'get', $params);
+ $result = civicrm_api3('Event', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetEventByEventTitle
-* and can be found in
+* The test that created it is called "testGetEventByEventTitle"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using event get API.
+ * Test Generated example demonstrating the Event.get API.
*
* Demonstrates use of is.Current option.
*
);
try{
- $result = civicrm_api3('event', 'get', $params);
+ $result = civicrm_api3('Event', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetIsCurrent
-* and can be found in
+* The test that created it is called "testGetIsCurrent"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using event getsingle API.
+ * Test Generated example demonstrating the Event.getsingle API.
*
* Demonstrates use of return is_full .
*
);
try{
- $result = civicrm_api3('event', 'getsingle', $params);
+ $result = civicrm_api3('Event', 'getsingle', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
'is_multiple_registrations' => 0,
'allow_same_participant_emails' => 0,
'is_template' => 0,
- 'created_date' => '2015-02-16 11:40:40',
+ 'created_date' => '2015-02-22 23:13:11',
'is_share' => '1',
'is_confirm_enabled' => '1',
'is_billing_required' => 0,
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetSingleReturnIsFull
-* and can be found in
+* The test that created it is called "testGetSingleReturnIsFull"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using grant create API.
+ * Test Generated example demonstrating the Grant.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('grant', 'create', $params);
+ $result = civicrm_api3('Grant', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateGrant
-* and can be found in
+* The test that created it is called "testCreateGrant"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GrantTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using grant delete API.
+ * Test Generated example demonstrating the Grant.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('grant', 'delete', $params);
+ $result = civicrm_api3('Grant', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteGrant
-* and can be found in
+* The test that created it is called "testDeleteGrant"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GrantTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using grant get API.
+ * Test Generated example demonstrating the Grant.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('grant', 'get', $params);
+ $result = civicrm_api3('Grant', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetGrant
-* and can be found in
+* The test that created it is called "testGetGrant"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GrantTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using group get API.
+ * Test Generated example demonstrating the Group.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('group', 'get', $params);
+ $result = civicrm_api3('Group', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetGroupParamsWithGroupName
-* and can be found in
+* The test that created it is called "testGetGroupParamsWithGroupName"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using group getfields API.
+ * Test Generated example demonstrating the Group.getfields API.
*
* Demonstrate use of getfields to interrogate api.
*
);
try{
- $result = civicrm_api3('group', 'getfields', $params);
+ $result = civicrm_api3('Group', 'getfields', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testgetfields
-* and can be found in
+* The test that created it is called "testgetfields"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using group_contact create API.
+ * Test Generated example demonstrating the GroupContact.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('group_contact', 'create', $params);
+ $result = civicrm_api3('GroupContact', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreate
-* and can be found in
+* The test that created it is called "testCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using group_contact delete API.
+ * Test Generated example demonstrating the GroupContact.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('group_contact', 'delete', $params);
+ $result = civicrm_api3('GroupContact', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeletePermanent
-* and can be found in
+* The test that created it is called "testDeletePermanent"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using group_contact get API.
+ * Test Generated example demonstrating the GroupContact.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('group_contact', 'get', $params);
+ $result = civicrm_api3('GroupContact', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGet
-* and can be found in
+* The test that created it is called "testGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using group_contact get API.
+ * Test Generated example demonstrating the GroupContact.get API.
*
* Get all from group and display contacts.
*
);
try{
- $result = civicrm_api3('group_contact', 'get', $params);
+ $result = civicrm_api3('GroupContact', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetGroupID
-* and can be found in
+* The test that created it is called "testGetGroupID"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupContactTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using group_nesting create API.
+ * Test Generated example demonstrating the GroupNesting.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('group_nesting', 'create', $params);
+ $result = civicrm_api3('GroupNesting', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreate
-* and can be found in
+* The test that created it is called "testCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupNestingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using group_nesting delete API.
+ * Test Generated example demonstrating the GroupNesting.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('group_nesting', 'delete', $params);
+ $result = civicrm_api3('GroupNesting', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDelete
-* and can be found in
+* The test that created it is called "testDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupNestingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using group_nesting get API.
+ * Test Generated example demonstrating the GroupNesting.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('group_nesting', 'get', $params);
+ $result = civicrm_api3('GroupNesting', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGet
-* and can be found in
+* The test that created it is called "testGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupNestingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using group_organization create API.
+ * Test Generated example demonstrating the GroupOrganization.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('group_organization', 'create', $params);
+ $result = civicrm_api3('GroupOrganization', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGroupOrganizationCreate
-* and can be found in
+* The test that created it is called "testGroupOrganizationCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupOrganizationTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using group_organization delete API.
+ * Test Generated example demonstrating the GroupOrganization.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('group_organization', 'delete', $params);
+ $result = civicrm_api3('GroupOrganization', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGroupOrganizationDelete
-* and can be found in
+* The test that created it is called "testGroupOrganizationDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupOrganizationTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using group_organization get API.
+ * Test Generated example demonstrating the GroupOrganization.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('group_organization', 'get', $params);
+ $result = civicrm_api3('GroupOrganization', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGroupOrganizationGet
-* and can be found in
+* The test that created it is called "testGroupOrganizationGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupOrganizationTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using im create API.
+ * Test Generated example demonstrating the Im.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('im', 'create', $params);
+ $result = civicrm_api3('Im', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateIm
-* and can be found in
+* The test that created it is called "testCreateIm"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ImTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using im delete API.
+ * Test Generated example demonstrating the Im.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('im', 'delete', $params);
+ $result = civicrm_api3('Im', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteIm
-* and can be found in
+* The test that created it is called "testDeleteIm"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ImTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using im get API.
+ * Test Generated example demonstrating the Im.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('im', 'get', $params);
+ $result = civicrm_api3('Im', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetIm
-* and can be found in
+* The test that created it is called "testGetIm"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ImTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using job create API.
+ * Test Generated example demonstrating the Job.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('job', 'create', $params);
+ $result = civicrm_api3('Job', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreate
-* and can be found in
+* The test that created it is called "testCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/JobTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using job delete API.
+ * Test Generated example demonstrating the Job.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('job', 'delete', $params);
+ $result = civicrm_api3('Job', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDelete
-* and can be found in
+* The test that created it is called "testDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/JobTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using line_item create API.
+ * Test Generated example demonstrating the LineItem.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('line_item', 'create', $params);
+ $result = civicrm_api3('LineItem', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateLineItem
-* and can be found in
+* The test that created it is called "testCreateLineItem"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LineItemTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using line_item delete API.
+ * Test Generated example demonstrating the LineItem.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('line_item', 'delete', $params);
+ $result = civicrm_api3('LineItem', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteLineItem
-* and can be found in
+* The test that created it is called "testDeleteLineItem"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LineItemTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using line_item get API.
+ * Test Generated example demonstrating the LineItem.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('line_item', 'get', $params);
+ $result = civicrm_api3('LineItem', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetBasicLineItem
-* and can be found in
+* The test that created it is called "testGetBasicLineItem"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LineItemTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using loc_block create API.
+ * Test Generated example demonstrating the LocBlock.create API.
*
* Create locBlock with existing entities
*
);
try{
- $result = civicrm_api3('loc_block', 'create', $params);
+ $result = civicrm_api3('LocBlock', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateLocBlock
-* and can be found in
+* The test that created it is called "testCreateLocBlock"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LocBlockTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using loc_block create API.
+ * Test Generated example demonstrating the LocBlock.create API.
*
* Create entities and locBlock in 1 api call.
*
);
try{
- $result = civicrm_api3('loc_block', 'create', $params);
+ $result = civicrm_api3('LocBlock', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateLocBlockEntities
-* and can be found in
+* The test that created it is called "testCreateLocBlockEntities"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LocBlockTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using loc_block get API.
+ * Test Generated example demonstrating the LocBlock.get API.
*
* Get entities and location block in 1 api call
*
);
try{
- $result = civicrm_api3('loc_block', 'get', $params);
+ $result = civicrm_api3('LocBlock', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateLocBlockEntities
-* and can be found in
+* The test that created it is called "testCreateLocBlockEntities"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LocBlockTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using mail_settings get API.
+ * Test Generated example demonstrating the MailSettings.get API.
*
* Demonstrates get + delete in the same call.
*
);
try{
- $result = civicrm_api3('mail_settings', 'get', $params);
+ $result = civicrm_api3('MailSettings', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetMailSettingsChainDelete
-* and can be found in
+* The test that created it is called "testGetMailSettingsChainDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailSettingsTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using mail_settings create API.
+ * Test Generated example demonstrating the MailSettings.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('mail_settings', 'create', $params);
+ $result = civicrm_api3('MailSettings', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'id' => 2,
+ 'id' => 5,
'values' => array(
- '2' => array(
- 'id' => '2',
+ '5' => array(
+ 'id' => '5',
'domain_id' => '1',
'name' => 'my mail setting',
'is_default' => '1',
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateMailSettings
-* and can be found in
+* The test that created it is called "testDeleteMailSettings"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailSettingsTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using mail_settings delete API.
+ * Test Generated example demonstrating the MailSettings.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('mail_settings', 'delete', $params);
+ $result = civicrm_api3('MailSettings', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteMailSettings
-* and can be found in
+* The test that created it is called "testDeleteMailSettings"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailSettingsTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using mail_settings get API.
+ * Test Generated example demonstrating the MailSettings.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('mail_settings', 'get', $params);
+ $result = civicrm_api3('MailSettings', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetMailSettings
-* and can be found in
+* The test that created it is called "testGetMailSettings"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailSettingsTest.php
*
* You can see the outcome of the API tests at
--- /dev/null
+<?php
+/**
+ * Test Generated example demonstrating the MailSettings.getoptions API.
+ *
+ * @return array
+ * API result array
+ */
+function mail_settings_getoptions_example() {
+ $params = array(
+ 'field' => 'protocol',
+ );
+
+ try{
+ $result = civicrm_api3('MailSettings', 'getoptions', $params);
+ }
+ catch (CiviCRM_API3_Exception $e) {
+ // Handle error here.
+ $errorMessage = $e->getMessage();
+ $errorCode = $e->getErrorCode();
+ $errorData = $e->getExtraParams();
+ return array(
+ 'error' => $errorMessage,
+ 'error_code' => $errorCode,
+ 'error_data' => $errorData,
+ );
+ }
+
+ return $result;
+}
+
+/**
+ * Function returns array of result expected from previous function.
+ *
+ * @return array
+ * API result array
+ */
+function mail_settings_getoptions_expectedresult() {
+
+ $expectedResult = array(
+ 'is_error' => 0,
+ 'version' => 3,
+ 'count' => 4,
+ 'values' => array(
+ '1' => 'IMAP',
+ '2' => 'Maildir',
+ '3' => 'POP3',
+ '4' => 'Localdir',
+ ),
+ );
+
+ return $expectedResult;
+}
+
+/*
+* This example has been generated from the API test suite.
+* The test that created it is called "testmailProtocol"
+* and can be found at:
+* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ConstantTest.php
+*
+* You can see the outcome of the API tests at
+* https://test.civicrm.org/job/CiviCRM-master-git/
+*
+* To Learn about the API read
+* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
+*
+* Browse the api on your own site with the api explorer
+* http://MYSITE.ORG/path/to/civicrm/api
+*
+* Read more about testing here
+* http://wiki.civicrm.org/confluence/display/CRM/Testing
+*
+* API Standards documentation:
+* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
+*/
<?php
/**
- * Test Generated example of using mailing create API.
+ * Test Generated example demonstrating the Mailing.create API.
*
* @return array
* API result array
{domain.address}{action.optOutUrl}',
'body_html' => '<p>This is {contact.display_name}.</p><p>{domain.address}{action.optOutUrl}</p>',
'name' => 'mailing name',
- 'created_id' => 3,
+ 'created_id' => 9,
'header_id' => '',
'footer_id' => '',
- 'scheduled_date' => 'now',
+ 'groups' => array(
+ 'include' => array(
+ '0' => 7,
+ ),
+ 'exclude' => array(
+ '0' => 8,
+ ),
+ ),
+ 'mailings' => array(
+ 'include' => array(),
+ 'exclude' => array(),
+ ),
+ 'options' => array(
+ 'force_rollback' => 1,
+ ),
+ 'api.mailing_job.create' => 1,
+ 'api.MailingRecipients.get' => array(
+ 'mailing_id' => '$value.id',
+ 'api.contact.getvalue' => array(
+ 'return' => 'display_name',
+ ),
+ 'api.email.getvalue' => array(
+ 'return' => 'email',
+ ),
+ ),
);
try{
- $result = civicrm_api3('mailing', 'create', $params);
+ $result = civicrm_api3('Mailing', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'id' => 1,
+ 'id' => 4,
'values' => array(
- '1' => array(
- 'id' => '1',
+ '4' => array(
+ 'id' => '4',
'domain_id' => '1',
'header_id' => '',
'footer_id' => '',
'is_completed' => '',
'msg_template_id' => '',
'override_verp' => '1',
- 'created_id' => '3',
+ 'created_id' => '9',
'created_date' => '2013-07-28 08:49:19',
'scheduled_id' => '',
- 'scheduled_date' => '20130728085413',
+ 'scheduled_date' => '',
'approver_id' => '',
'approval_date' => '',
'approval_status_id' => '',
'hash' => '',
'location_type_id' => '',
'email_selection_method' => '',
+ 'api.mailing_job.create' => array(
+ 'is_error' => 0,
+ 'version' => 3,
+ 'count' => 1,
+ 'id' => 5,
+ 'values' => array(
+ '0' => array(
+ 'id' => '5',
+ 'mailing_id' => '4',
+ 'scheduled_date' => '20130728085413',
+ 'start_date' => '',
+ 'end_date' => '',
+ 'status' => 'Scheduled',
+ 'is_test' => 0,
+ 'job_type' => '',
+ 'parent_id' => '',
+ 'job_offset' => '',
+ 'job_limit' => '',
+ ),
+ ),
+ ),
+ 'api.MailingRecipients.get' => array(
+ 'is_error' => 0,
+ 'version' => 3,
+ 'count' => 1,
+ 'id' => 4,
+ 'values' => array(
+ '0' => array(
+ 'id' => '4',
+ 'mailing_id' => '4',
+ 'contact_id' => '10',
+ 'email_id' => '10',
+ 'api.contact.getvalue' => 'Mr. Includer Person II',
+ 'api.email.getvalue' => 'include.me@example.org',
+ ),
+ ),
+ ),
),
),
);
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testMailerCreateSuccess
-* and can be found in
+* The test that created it is called "testMailerPreviewRecipients"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using mailing delete API.
+ * Test Generated example demonstrating the Mailing.delete API.
*
* @return array
* API result array
*/
function mailing_delete_example() {
$params = array(
- 'id' => 16,
+ 'id' => 18,
);
try{
- $result = civicrm_api3('mailing', 'delete', $params);
+ $result = civicrm_api3('Mailing', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testMailerDeleteSuccess
-* and can be found in
+* The test that created it is called "testMailerDeleteSuccess"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using mailing submit API.
+ * Test Generated example demonstrating the Mailing.submit API.
*
* @return array
* API result array
function mailing_submit_example() {
$params = array(
'scheduled_date' => '2014-12-13 10:00:00',
- 'id' => 9,
+ 'approval_date' => '2014-12-13 00:00:00',
+ 'id' => 16,
);
try{
- $result = civicrm_api3('mailing', 'submit', $params);
+ $result = civicrm_api3('Mailing', 'submit', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'id' => 9,
+ 'id' => 16,
'values' => array(
- '9' => array(
- 'id' => '9',
+ '16' => array(
+ 'id' => '16',
'domain_id' => '1',
'header_id' => '',
- 'footer_id' => '',
+ 'footer_id' => '24',
'reply_id' => '8',
'unsubscribe_id' => '5',
'resubscribe_id' => '6',
'subject' => 'Hello {contact.display_name}',
'body_text' => 'This is {contact.display_name}.
{domain.address}{action.optOutUrl}',
- 'body_html' => '<p>This is {contact.display_name}.</p><p>{domain.address}{action.optOutUrl}</p>',
+ 'body_html' => '<p>Look ma, magic tokens in the markup!</p>',
'url_tracking' => '1',
'forward_replies' => 0,
'auto_responder' => 0,
'is_completed' => '',
'msg_template_id' => '',
'override_verp' => '1',
- 'created_id' => '22',
+ 'created_id' => '35',
'created_date' => '2013-07-28 08:49:19',
- 'scheduled_id' => '22',
+ 'scheduled_id' => '36',
'scheduled_date' => '20130728085413',
- 'approver_id' => '',
- 'approval_date' => '',
- 'approval_status_id' => '',
+ 'approver_id' => '36',
+ 'approval_date' => '20130728085413',
+ 'approval_status_id' => '1',
'approval_note' => '',
'is_archived' => 0,
'visibility' => 'Public Pages',
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testMailerSubmit
-* and can be found in
+* The test that created it is called "testMailerSubmit"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using mailing_a_b create API.
+ * Test Generated example demonstrating the MailingAB.create API.
*
* @return array
* API result array
'mailing_id_a' => 1,
'mailing_id_b' => 2,
'mailing_id_c' => 3,
- 'testing_criteria_id' => 1,
- 'winner_criteria_id' => 1,
+ 'testing_criteria' => 'subject',
+ 'winner_criteria' => 'open',
'declare_winning_time' => '+2 days',
'group_percentage' => 10,
);
try{
- $result = civicrm_api3('mailing_a_b', 'create', $params);
+ $result = civicrm_api3('MailingAB', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
'mailing_id_b' => '2',
'mailing_id_c' => '3',
'domain_id' => '1',
- 'testing_criteria_id' => '1',
- 'winner_criteria_id' => '1',
+ 'testing_criteria_id' => '',
+ 'winner_criteria_id' => '',
'specific_url' => '',
- 'declare_winning_time' => '20150218114218',
+ 'declare_winning_time' => '20150224231452',
'group_percentage' => '10',
),
),
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testMailingABCreateSuccess
-* and can be found in
+* The test that created it is called "testMailingABCreateSuccess"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingABTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using membership create API.
+ * Test Generated example demonstrating the Membership.create API.
*
* @return array
* API result array
*/
function membership_create_example() {
$params = array(
- 'contact_id' => 88,
- 'membership_type_id' => 53,
- 'join_date' => '2009-01-21',
- 'start_date' => '2009-01-21',
- 'end_date' => '2009-12-21',
+ 'contact_id' => 76,
+ 'membership_type_id' => 45,
+ 'join_date' => '2006-01-21',
+ 'start_date' => '2006-01-21',
+ 'end_date' => '2006-12-21',
'source' => 'Payment',
'is_override' => 1,
- 'status_id' => 33,
- 'custom_1' => 'custom string',
+ 'status_id' => 29,
);
try{
- $result = civicrm_api3('membership', 'create', $params);
+ $result = civicrm_api3('Membership', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
'values' => array(
'1' => array(
'id' => '1',
- 'contact_id' => '88',
- 'membership_type_id' => '53',
- 'join_date' => '20090121000000',
+ 'contact_id' => '76',
+ 'membership_type_id' => '45',
+ 'join_date' => '20060121000000',
'start_date' => '2013-07-29 00:00:00',
'end_date' => '2013-08-04 00:00:00',
'source' => 'Payment',
- 'status_id' => '33',
+ 'status_id' => '29',
'is_override' => '1',
'owner_membership_id' => '',
'max_related' => '',
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateWithCustom
-* and can be found in
+* The test that created it is called "testMembershipCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php
*
* You can see the outcome of the API tests at
--- /dev/null
+<?php
+/**
+ * Test Generated example demonstrating the Membership.create API.
+ *
+ * @return array
+ * API result array
+ */
+function membership_create_example() {
+ $params = array(
+ 'contact_id' => 88,
+ 'membership_type_id' => 53,
+ 'join_date' => '2009-01-21',
+ 'start_date' => '2009-01-21',
+ 'end_date' => '2009-12-21',
+ 'source' => 'Payment',
+ 'is_override' => 1,
+ 'status_id' => 33,
+ 'custom_1' => 'custom string',
+ );
+
+ try{
+ $result = civicrm_api3('Membership', 'create', $params);
+ }
+ catch (CiviCRM_API3_Exception $e) {
+ // Handle error here.
+ $errorMessage = $e->getMessage();
+ $errorCode = $e->getErrorCode();
+ $errorData = $e->getExtraParams();
+ return array(
+ 'error' => $errorMessage,
+ 'error_code' => $errorCode,
+ 'error_data' => $errorData,
+ );
+ }
+
+ return $result;
+}
+
+/**
+ * Function returns array of result expected from previous function.
+ *
+ * @return array
+ * API result array
+ */
+function membership_create_expectedresult() {
+
+ $expectedResult = array(
+ 'is_error' => 0,
+ 'version' => 3,
+ 'count' => 1,
+ 'id' => 1,
+ 'values' => array(
+ '1' => array(
+ 'id' => '1',
+ 'contact_id' => '88',
+ 'membership_type_id' => '53',
+ 'join_date' => '20090121000000',
+ 'start_date' => '2013-07-29 00:00:00',
+ 'end_date' => '2013-08-04 00:00:00',
+ 'source' => 'Payment',
+ 'status_id' => '33',
+ 'is_override' => '1',
+ 'owner_membership_id' => '',
+ 'max_related' => '',
+ 'is_test' => 0,
+ 'is_pay_later' => '',
+ 'contribution_recur_id' => '',
+ 'campaign_id' => '',
+ ),
+ ),
+ );
+
+ return $expectedResult;
+}
+
+/*
+* This example has been generated from the API test suite.
+* The test that created it is called "testCreateWithCustom"
+* and can be found at:
+* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php
+*
+* You can see the outcome of the API tests at
+* https://test.civicrm.org/job/CiviCRM-master-git/
+*
+* To Learn about the API read
+* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
+*
+* Browse the api on your own site with the api explorer
+* http://MYSITE.ORG/path/to/civicrm/api
+*
+* Read more about testing here
+* http://wiki.civicrm.org/confluence/display/CRM/Testing
+*
+* API Standards documentation:
+* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
+*/
<?php
/**
- * Test Generated example of using membership delete API.
+ * Test Generated example demonstrating the Membership.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('membership', 'delete', $params);
+ $result = civicrm_api3('Membership', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testMembershipDelete
-* and can be found in
+* The test that created it is called "testMembershipDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using membership get API.
+ * Test Generated example demonstrating the Membership.get API.
*
* Demonstrates use of 'filter' active_only' param.
*
);
try{
- $result = civicrm_api3('membership', 'get', $params);
+ $result = civicrm_api3('Membership', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetOnlyActive
-* and can be found in
+* The test that created it is called "testGetOnlyActive"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using membership get API.
+ * Test Generated example demonstrating the Membership.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('membership', 'get', $params);
+ $result = civicrm_api3('Membership', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetWithParamsMemberShipIdAndCustom
-* and can be found in
+* The test that created it is called "testGetWithParamsMemberShipIdAndCustom"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using membership update API.
+ * Test Generated example demonstrating the Membership.create API.
*
* @return array
* API result array
*/
-function membership_update_example() {
+function membership_create_example() {
$params = array(
'contact_id' => 106,
'membership_type_id' => 65,
);
try{
- $result = civicrm_api3('membership', 'update', $params);
+ $result = civicrm_api3('Membership', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
* @return array
* API result array
*/
-function membership_update_expectedresult() {
+function membership_create_expectedresult() {
$expectedResult = array(
'is_error' => 0,
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testUpdateWithCustom
-* and can be found in
+* The test that created it is called "testUpdateWithCustom"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using membership_payment create API.
+ * Test Generated example demonstrating the MembershipPayment.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('membership_payment', 'create', $params);
+ $result = civicrm_api3('MembershipPayment', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreate
-* and can be found in
+* The test that created it is called "testCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipPaymentTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using membership_payment get API.
+ * Test Generated example demonstrating the MembershipPayment.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('membership_payment', 'get', $params);
+ $result = civicrm_api3('MembershipPayment', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGet
-* and can be found in
+* The test that created it is called "testGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipPaymentTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using membership_status create API.
+ * Test Generated example demonstrating the MembershipStatus.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('membership_status', 'create', $params);
+ $result = civicrm_api3('MembershipStatus', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreate
-* and can be found in
+* The test that created it is called "testCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipStatusTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using membership_status get API.
+ * Test Generated example demonstrating the MembershipStatus.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('membership_status', 'get', $params);
+ $result = civicrm_api3('MembershipStatus', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGet
-* and can be found in
+* The test that created it is called "testGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipStatusTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using membership_type create API.
+ * Test Generated example demonstrating the MembershipType.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('membership_type', 'create', $params);
+ $result = civicrm_api3('MembershipType', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreate
-* and can be found in
+* The test that created it is called "testCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTypeTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using membership_type delete API.
+ * Test Generated example demonstrating the MembershipType.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('membership_type', 'delete', $params);
+ $result = civicrm_api3('MembershipType', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDelete
-* and can be found in
+* The test that created it is called "testDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTypeTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using membership_type get API.
+ * Test Generated example demonstrating the MembershipType.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('membership_type', 'get', $params);
+ $result = civicrm_api3('MembershipType', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGet
-* and can be found in
+* The test that created it is called "testGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTypeTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using message_template create API.
+ * Test Generated example demonstrating the MessageTemplate.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('message_template', 'create', $params);
+ $result = civicrm_api3('MessageTemplate', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreate
-* and can be found in
+* The test that created it is called "testCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MessageTemplateTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using message_template delete API.
+ * Test Generated example demonstrating the MessageTemplate.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('message_template', 'delete', $params);
+ $result = civicrm_api3('MessageTemplate', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDelete
-* and can be found in
+* The test that created it is called "testDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MessageTemplateTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using message_template get API.
+ * Test Generated example demonstrating the MessageTemplate.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('message_template', 'get', $params);
+ $result = civicrm_api3('MessageTemplate', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGet
-* and can be found in
+* The test that created it is called "testGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MessageTemplateTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using note create API.
+ * Test Generated example demonstrating the Note.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('note', 'create', $params);
+ $result = civicrm_api3('Note', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreate
-* and can be found in
+* The test that created it is called "testCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/NoteTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using note delete API.
+ * Test Generated example demonstrating the Note.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('note', 'delete', $params);
+ $result = civicrm_api3('Note', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDelete
-* and can be found in
+* The test that created it is called "testDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/NoteTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using note get API.
+ * Test Generated example demonstrating the Note.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('note', 'get', $params);
+ $result = civicrm_api3('Note', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGet
-* and can be found in
+* The test that created it is called "testGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/NoteTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using option_group create API.
+ * Test Generated example demonstrating the OptionGroup.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('option_group', 'create', $params);
+ $result = civicrm_api3('OptionGroup', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetOptionCreateSuccess
-* and can be found in
+* The test that created it is called "testGetOptionCreateSuccess"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionGroupTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using option_group delete API.
+ * Test Generated example demonstrating the OptionGroup.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('option_group', 'delete', $params);
+ $result = civicrm_api3('OptionGroup', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteOptionGroup
-* and can be found in
+* The test that created it is called "testDeleteOptionGroup"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionGroupTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using option_group get API.
+ * Test Generated example demonstrating the OptionGroup.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('option_group', 'get', $params);
+ $result = civicrm_api3('OptionGroup', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetOptionGroupByName
-* and can be found in
+* The test that created it is called "testGetOptionGroupByName"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionGroupTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using option_value get API.
+ * Test Generated example demonstrating the OptionValue.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('option_value', 'get', $params);
+ $result = civicrm_api3('OptionValue', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetOptionGroup
-* and can be found in
+* The test that created it is called "testGetOptionGroup"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionValueTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using option_value getsingle API.
+ * Test Generated example demonstrating the OptionValue.getsingle API.
*
* Demonstrates use of Sort param (available in many api functions). Also, getsingle.
*
);
try{
- $result = civicrm_api3('option_value', 'getsingle', $params);
+ $result = civicrm_api3('OptionValue', 'getsingle', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetSingleValueOptionValueSort
-* and can be found in
+* The test that created it is called "testGetSingleValueOptionValueSort"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionValueTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using participant create API.
+ * Test Generated example demonstrating the Participant.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('participant', 'create', $params);
+ $result = civicrm_api3('Participant', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateWithCustom
-* and can be found in
+* The test that created it is called "testCreateWithCustom"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using participant get API.
+ * Test Generated example demonstrating the Participant.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('participant', 'get', $params);
+ $result = civicrm_api3('Participant', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetParamsAsIdOnly
-* and can be found in
+* The test that created it is called "testGetParamsAsIdOnly"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using participant Get API.
+ * Test Generated example demonstrating the Participant.get API.
*
* Criteria delete by nesting a GET & a DELETE.
*
);
try{
- $result = civicrm_api3('participant', 'Get', $params);
+ $result = civicrm_api3('Participant', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testNestedDelete
-* and can be found in
+* The test that created it is called "testNestedDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using participant get API.
+ * Test Generated example demonstrating the Participant.get API.
*
* Demonstrates use of nested get to fetch event data with participant records.
*
);
try{
- $result = civicrm_api3('participant', 'get', $params);
+ $result = civicrm_api3('Participant', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetNestedEventGet
-* and can be found in
+* The test that created it is called "testGetNestedEventGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using participant_payment create API.
+ * Test Generated example demonstrating the ParticipantPayment.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('participant_payment', 'create', $params);
+ $result = civicrm_api3('ParticipantPayment', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testPaymentCreate
-* and can be found in
+* The test that created it is called "testPaymentCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantPaymentTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using participant_payment delete API.
+ * Test Generated example demonstrating the ParticipantPayment.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('participant_payment', 'delete', $params);
+ $result = civicrm_api3('ParticipantPayment', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testPaymentDelete
-* and can be found in
+* The test that created it is called "testPaymentDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantPaymentTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using participant_payment get API.
+ * Test Generated example demonstrating the ParticipantPayment.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('participant_payment', 'get', $params);
+ $result = civicrm_api3('ParticipantPayment', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGet
-* and can be found in
+* The test that created it is called "testGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantPaymentTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using participant_status_type create API.
+ * Test Generated example demonstrating the ParticipantStatusType.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('participant_status_type', 'create', $params);
+ $result = civicrm_api3('ParticipantStatusType', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'id' => 16,
+ 'id' => 17,
'values' => array(
- '16' => array(
- 'id' => '16',
+ '17' => array(
+ 'id' => '17',
'name' => 'test status',
'label' => 'I am a test',
'class' => 'Positive',
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateParticipantStatusType
-* and can be found in
+* The test that created it is called "testGetParticipantStatusType"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantStatusTypeTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using participant_status_type delete API.
+ * Test Generated example demonstrating the ParticipantStatusType.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('participant_status_type', 'delete', $params);
+ $result = civicrm_api3('ParticipantStatusType', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteParticipantStatusType
-* and can be found in
+* The test that created it is called "testDeleteParticipantStatusType"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantStatusTypeTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using participant_status_type get API.
+ * Test Generated example demonstrating the ParticipantStatusType.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('participant_status_type', 'get', $params);
+ $result = civicrm_api3('ParticipantStatusType', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetParticipantStatusType
-* and can be found in
+* The test that created it is called "testGetParticipantStatusType"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantStatusTypeTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using payment_processor create API.
+ * Test Generated example demonstrating the PaymentProcessor.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('payment_processor', 'create', $params);
+ $result = civicrm_api3('PaymentProcessor', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testPaymentProcessorCreate
-* and can be found in
+* The test that created it is called "testPaymentProcessorCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using payment_processor delete API.
+ * Test Generated example demonstrating the PaymentProcessor.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('payment_processor', 'delete', $params);
+ $result = civicrm_api3('PaymentProcessor', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testPaymentProcessorDelete
-* and can be found in
+* The test that created it is called "testPaymentProcessorDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using payment_processor_type create API.
+ * Test Generated example demonstrating the PaymentProcessorType.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('payment_processor_type', 'create', $params);
+ $result = civicrm_api3('PaymentProcessorType', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testPaymentProcessorTypeCreate
-* and can be found in
+* The test that created it is called "testPaymentProcessorTypeCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTypeTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using payment_processor_type delete API.
+ * Test Generated example demonstrating the PaymentProcessorType.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('payment_processor_type', 'delete', $params);
+ $result = civicrm_api3('PaymentProcessorType', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testPaymentProcessorTypeDelete
-* and can be found in
+* The test that created it is called "testPaymentProcessorTypeDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTypeTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using phone create API.
+ * Test Generated example demonstrating the Phone.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('phone', 'create', $params);
+ $result = civicrm_api3('Phone', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreatePhone
-* and can be found in
+* The test that created it is called "testCreatePhone"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PhoneTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using phone delete API.
+ * Test Generated example demonstrating the Phone.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('phone', 'delete', $params);
+ $result = civicrm_api3('Phone', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeletePhone
-* and can be found in
+* The test that created it is called "testDeletePhone"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PhoneTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using phone get API.
+ * Test Generated example demonstrating the Phone.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('phone', 'get', $params);
+ $result = civicrm_api3('Phone', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGet
-* and can be found in
+* The test that created it is called "testGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PhoneTest.php
*
* You can see the outcome of the API tests at
--- /dev/null
+<?php
+/**
+ * Test Generated example demonstrating the Phone.getoptions API.
+ *
+ * @return array
+ * API result array
+ */
+function phone_getoptions_example() {
+ $params = array(
+ 'field' => 'phone_type_id',
+ );
+
+ try{
+ $result = civicrm_api3('Phone', 'getoptions', $params);
+ }
+ catch (CiviCRM_API3_Exception $e) {
+ // Handle error here.
+ $errorMessage = $e->getMessage();
+ $errorCode = $e->getErrorCode();
+ $errorData = $e->getExtraParams();
+ return array(
+ 'error' => $errorMessage,
+ 'error_code' => $errorCode,
+ 'error_data' => $errorData,
+ );
+ }
+
+ return $result;
+}
+
+/**
+ * Function returns array of result expected from previous function.
+ *
+ * @return array
+ * API result array
+ */
+function phone_getoptions_expectedresult() {
+
+ $expectedResult = array(
+ 'is_error' => 0,
+ 'version' => 3,
+ 'count' => 5,
+ 'values' => array(
+ '1' => 'Phone',
+ '2' => 'Mobile',
+ '3' => 'Fax',
+ '4' => 'Pager',
+ '5' => 'Voicemail',
+ ),
+ );
+
+ return $expectedResult;
+}
+
+/*
+* This example has been generated from the API test suite.
+* The test that created it is called "testPhoneType"
+* and can be found at:
+* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ConstantTest.php
+*
+* You can see the outcome of the API tests at
+* https://test.civicrm.org/job/CiviCRM-master-git/
+*
+* To Learn about the API read
+* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
+*
+* Browse the api on your own site with the api explorer
+* http://MYSITE.ORG/path/to/civicrm/api
+*
+* Read more about testing here
+* http://wiki.civicrm.org/confluence/display/CRM/Testing
+*
+* API Standards documentation:
+* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
+*/
<?php
/**
- * Test Generated example of using pledge create API.
+ * Test Generated example demonstrating the Pledge.create API.
*
* @return array
* API result array
function pledge_create_example() {
$params = array(
'contact_id' => 11,
- 'pledge_create_date' => '20150216',
- 'start_date' => '20150216',
- 'scheduled_date' => '20150218',
+ 'pledge_create_date' => '20150222',
+ 'start_date' => '20150222',
+ 'scheduled_date' => '20150224',
'amount' => '100',
'pledge_status_id' => '2',
'pledge_financial_type_id' => '1',
);
try{
- $result = civicrm_api3('pledge', 'create', $params);
+ $result = civicrm_api3('Pledge', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreatePledge
-* and can be found in
+* The test that created it is called "testCreatePledge"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using pledge delete API.
+ * Test Generated example demonstrating the Pledge.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('pledge', 'delete', $params);
+ $result = civicrm_api3('Pledge', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeletePledgeUseID
-* and can be found in
+* The test that created it is called "testDeletePledgeUseID"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using pledge get API.
+ * Test Generated example demonstrating the Pledge.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('pledge', 'get', $params);
+ $result = civicrm_api3('Pledge', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
'display_name' => 'Mr. Anthony Anderson II',
'pledge_id' => '1',
'pledge_amount' => '100.00',
- 'pledge_create_date' => '2015-02-16 00:00:00',
+ 'pledge_create_date' => '2015-02-22 00:00:00',
'pledge_status' => 'Pending',
'pledge_total_paid' => '',
- 'pledge_next_pay_date' => '2015-02-18 00:00:00',
+ 'pledge_next_pay_date' => '2015-02-24 00:00:00',
'pledge_next_pay_amount' => '20.00',
'pledge_outstanding_amount' => '',
'pledge_financial_type' => 'Donation',
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetPledge
-* and can be found in
+* The test that created it is called "testGetPledge"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using pledge get API.
+ * Test Generated example demonstrating the Pledge.get API.
*
* demonstrates high date filter
*
*/
function pledge_get_example() {
$params = array(
- 'pledge_start_date_high' => '20150214114707',
+ 'pledge_start_date_high' => '20150220231942',
);
try{
- $result = civicrm_api3('pledge', 'get', $params);
+ $result = civicrm_api3('Pledge', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
'display_name' => 'Mr. Anthony Anderson II',
'pledge_id' => '2',
'pledge_amount' => '100.00',
- 'pledge_create_date' => '2015-02-16 00:00:00',
+ 'pledge_create_date' => '2015-02-22 00:00:00',
'pledge_status' => 'Overdue',
'pledge_total_paid' => '',
'pledge_next_pay_date' => '2014-03-07 00:00:00',
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testPledgeGetReturnFilters
-* and can be found in
+* The test that created it is called "testPledgeGetReturnFilters"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using pledge_payment create API.
+ * Test Generated example demonstrating the PledgePayment.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('pledge_payment', 'create', $params);
+ $result = civicrm_api3('PledgePayment', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreatePledgePayment
-* and can be found in
+* The test that created it is called "testCreatePledgePayment"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using pledge_payment delete API.
+ * Test Generated example demonstrating the PledgePayment.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('pledge_payment', 'delete', $params);
+ $result = civicrm_api3('PledgePayment', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeletePledgePayment
-* and can be found in
+* The test that created it is called "testDeletePledgePayment"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using pledge_payment get API.
+ * Test Generated example demonstrating the PledgePayment.get API.
*
* @return array
* API result array
$params = array();
try{
- $result = civicrm_api3('pledge_payment', 'get', $params);
+ $result = civicrm_api3('PledgePayment', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetPledgePayment
-* and can be found in
+* The test that created it is called "testGetPledgePayment"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using pledge_payment update API.
+ * Test Generated example demonstrating the PledgePayment.update API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('pledge_payment', 'update', $params);
+ $result = civicrm_api3('PledgePayment', 'update', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testUpdatePledgePayment
-* and can be found in
+* The test that created it is called "testUpdatePledgePayment"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using price_field create API.
+ * Test Generated example demonstrating the PriceField.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('price_field', 'create', $params);
+ $result = civicrm_api3('PriceField', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreatePriceField
-* and can be found in
+* The test that created it is called "testCreatePriceField"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using price_field delete API.
+ * Test Generated example demonstrating the PriceField.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('price_field', 'delete', $params);
+ $result = civicrm_api3('PriceField', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeletePriceField
-* and can be found in
+* The test that created it is called "testDeletePriceField"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using price_field get API.
+ * Test Generated example demonstrating the PriceField.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('price_field', 'get', $params);
+ $result = civicrm_api3('PriceField', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetBasicPriceField
-* and can be found in
+* The test that created it is called "testGetBasicPriceField"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using price_field_value create API.
+ * Test Generated example demonstrating the PriceFieldValue.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('price_field_value', 'create', $params);
+ $result = civicrm_api3('PriceFieldValue', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreatePriceFieldValuewithMultipleTerms
-* and can be found in
+* The test that created it is called "testCreatePriceFieldValuewithMultipleTerms"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldValueTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using price_field_value delete API.
+ * Test Generated example demonstrating the PriceFieldValue.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('price_field_value', 'delete', $params);
+ $result = civicrm_api3('PriceFieldValue', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeletePriceFieldValue
-* and can be found in
+* The test that created it is called "testDeletePriceFieldValue"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldValueTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using price_field_value get API.
+ * Test Generated example demonstrating the PriceFieldValue.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('price_field_value', 'get', $params);
+ $result = civicrm_api3('PriceFieldValue', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetBasicPriceFieldValue
-* and can be found in
+* The test that created it is called "testGetBasicPriceFieldValue"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldValueTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using price_set create API.
+ * Test Generated example demonstrating the PriceSet.create API.
*
* @return array
* API result array
*/
function price_set_create_example() {
$params = array(
- 'name' => 'some_price_set',
- 'title' => 'Some Price Set',
- 'is_active' => 1,
- 'financial_type_id' => 1,
- 'extends' => array(
- '0' => 1,
- '1' => 2,
- ),
+ 'entity_table' => 'civicrm_event',
+ 'entity_id' => 1,
+ 'name' => 'event price',
+ 'title' => 'event price',
+ 'extends' => 1,
);
try{
- $result = civicrm_api3('price_set', 'create', $params);
+ $result = civicrm_api3('PriceSet', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'id' => 16,
+ 'id' => 18,
'values' => array(
- '16' => array(
- 'id' => '16',
+ '18' => array(
+ 'id' => '18',
'domain_id' => '',
- 'name' => 'some_price_set',
- 'title' => 'Some Price Set',
- 'is_active' => '1',
+ 'name' => 'event price',
+ 'title' => 'event price',
+ 'is_active' => '',
'help_pre' => '',
'help_post' => '',
'javascript' => '',
- 'extends' => array(
- '0' => '1',
- '1' => '2',
- ),
- 'financial_type_id' => '1',
+ 'extends' => '1',
+ 'financial_type_id' => '',
'is_quick_config' => '',
'is_reserved' => '',
),
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreatePriceSetForEventAndContribution
-* and can be found in
+* The test that created it is called "testEventPriceSet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceSetTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using price_set delete API.
+ * Test Generated example demonstrating the PriceSet.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('price_set', 'delete', $params);
+ $result = civicrm_api3('PriceSet', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeletePriceSet
-* and can be found in
+* The test that created it is called "testDeletePriceSet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceSetTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using price_set get API.
+ * Test Generated example demonstrating the PriceSet.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('price_set', 'get', $params);
+ $result = civicrm_api3('PriceSet', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetBasicPriceSet
-* and can be found in
+* The test that created it is called "testGetBasicPriceSet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceSetTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using profile apply API.
+ * Test Generated example demonstrating the Profile.apply API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('profile', 'apply', $params);
+ $result = civicrm_api3('Profile', 'apply', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testProfileApply
-* and can be found in
+* The test that created it is called "testProfileApply"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ProfileTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using profile get API.
+ * Test Generated example demonstrating the Profile.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('profile', 'get', $params);
+ $result = civicrm_api3('Profile', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testProfileGetMultiple
-* and can be found in
+* The test that created it is called "testProfileGetMultiple"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ProfileTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using profile getfields API.
+ * Test Generated example demonstrating the Profile.getfields API.
*
* demonstrates retrieving profile fields passing in an id
*
);
try{
- $result = civicrm_api3('profile', 'getfields', $params);
+ $result = civicrm_api3('Profile', 'getfields', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetFields
-* and can be found in
+* The test that created it is called "testGetFields"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ProfileTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using profile submit API.
+ * Test Generated example demonstrating the Profile.submit API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('profile', 'submit', $params);
+ $result = civicrm_api3('Profile', 'submit', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testProfileSubmit
-* and can be found in
+* The test that created it is called "testProfileSubmit"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ProfileTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using relationship get API.
+ * Test Generated example demonstrating the Relationship.get API.
*
* Demonstrates use of BETWEEN filter.
*
);
try{
- $result = civicrm_api3('relationship', 'get', $params);
+ $result = civicrm_api3('Relationship', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetTypeOperators
-* and can be found in
+* The test that created it is called "testGetTypeOperators"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using relationship create API.
+ * Test Generated example demonstrating the Relationship.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('relationship', 'create', $params);
+ $result = civicrm_api3('Relationship', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testRelationshipCreate
-* and can be found in
+* The test that created it is called "testRelationshipCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using relationship delete API.
+ * Test Generated example demonstrating the Relationship.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('relationship', 'delete', $params);
+ $result = civicrm_api3('Relationship', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testRelationshipDelete
-* and can be found in
+* The test that created it is called "testRelationshipDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using relationship get API.
+ * Test Generated example demonstrating the Relationship.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('relationship', 'get', $params);
+ $result = civicrm_api3('Relationship', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetWithCustom
-* and can be found in
+* The test that created it is called "testGetWithCustom"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using relationship get API.
+ * Test Generated example demonstrating the Relationship.get API.
*
* Demonstrates use of IN filter.
*
);
try{
- $result = civicrm_api3('relationship', 'get', $params);
+ $result = civicrm_api3('Relationship', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetTypeOperators
-* and can be found in
+* The test that created it is called "testGetTypeOperators"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using relationship get API.
+ * Test Generated example demonstrating the Relationship.get API.
*
* Demonstrates use of Not BETWEEN filter.
*
);
try{
- $result = civicrm_api3('relationship', 'get', $params);
+ $result = civicrm_api3('Relationship', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetTypeOperators
-* and can be found in
+* The test that created it is called "testGetTypeOperators"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using relationship get API.
+ * Test Generated example demonstrating the Relationship.get API.
*
* Demonstrates use of NOT IN filter.
*
);
try{
- $result = civicrm_api3('relationship', 'get', $params);
+ $result = civicrm_api3('Relationship', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetTypeOperators
-* and can be found in
+* The test that created it is called "testGetTypeOperators"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using relationship get API.
+ * Test Generated example demonstrating the Relationship.get API.
*
* Demonstrates is_current filter.
*
);
try{
- $result = civicrm_api3('relationship', 'get', $params);
+ $result = civicrm_api3('Relationship', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetIsCurrent
-* and can be found in
+* The test that created it is called "testGetIsCurrent"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using relationship_type create API.
+ * Test Generated example demonstrating the RelationshipType.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('relationship_type', 'create', $params);
+ $result = civicrm_api3('RelationshipType', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testRelationshipTypeCreate
-* and can be found in
+* The test that created it is called "testRelationshipTypeCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTypeTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using relationship_type delete API.
+ * Test Generated example demonstrating the RelationshipType.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('relationship_type', 'delete', $params);
+ $result = civicrm_api3('RelationshipType', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testRelationshipTypeDelete
-* and can be found in
+* The test that created it is called "testRelationshipTypeDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTypeTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using report_template getrows API.
+ * Test Generated example demonstrating the ReportTemplate.getrows API.
*
* Retrieve rows from a report template (optionally providing the instance_id).
*
);
try{
- $result = civicrm_api3('report_template', 'getrows', $params);
+ $result = civicrm_api3('ReportTemplate', 'getrows', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testReportTemplateGetRowsContactSummary
-* and can be found in
+* The test that created it is called "testReportTemplateGetRowsContactSummary"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ReportTemplateTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using report_template getstatistics API.
+ * Test Generated example demonstrating the ReportTemplate.getstatistics API.
*
* Get Statistics from a report (note there isn't much data to get in the test DB).
*
);
try{
- $result = civicrm_api3('report_template', 'getstatistics', $params);
+ $result = civicrm_api3('ReportTemplate', 'getstatistics', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testReportTemplateGetStatisticsAllReports
-* and can be found in
+* The test that created it is called "testReportTemplateGetStatisticsAllReports"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ReportTemplateTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using setting create API.
+ * Test Generated example demonstrating the Setting.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('setting', 'create', $params);
+ $result = civicrm_api3('Setting', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateSetting
-* and can be found in
+* The test that created it is called "testCreateSetting"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using setting create API.
+ * Test Generated example demonstrating the Setting.create API.
*
* Shows setting a variable for all domains.
*
);
try{
- $result = civicrm_api3('setting', 'create', $params);
+ $result = civicrm_api3('Setting', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateSettingMultipleDomains
-* and can be found in
+* The test that created it is called "testCreateSettingMultipleDomains"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using setting create API.
+ * Test Generated example demonstrating the Setting.create API.
*
* Shows setting a variable for a current domain.
*
);
try{
- $result = civicrm_api3('setting', 'create', $params);
+ $result = civicrm_api3('Setting', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateSetting
-* and can be found in
+* The test that created it is called "testCreateSetting"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using setting create API.
+ * Test Generated example demonstrating the Setting.create API.
*
* Shows setting a variable for specified domains.
*
);
try{
- $result = civicrm_api3('setting', 'create', $params);
+ $result = civicrm_api3('Setting', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateSettingMultipleDomains
-* and can be found in
+* The test that created it is called "testCreateSettingMultipleDomains"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using setting get API.
+ * Test Generated example demonstrating the Setting.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('setting', 'get', $params);
+ $result = civicrm_api3('Setting', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetSetting
-* and can be found in
+* The test that created it is called "testGetSetting"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using setting Get API.
+ * Test Generated example demonstrating the Setting.get API.
*
* Shows getting a variable for all domains.
*
);
try{
- $result = civicrm_api3('setting', 'Get', $params);
+ $result = civicrm_api3('Setting', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateSettingMultipleDomains
-* and can be found in
+* The test that created it is called "testCreateSettingMultipleDomains"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using setting getdefaults API.
+ * Test Generated example demonstrating the Setting.getdefaults API.
*
* Gets defaults setting a variable for a given domain - if no domain is set current is assumed.
*
);
try{
- $result = civicrm_api3('setting', 'getdefaults', $params);
+ $result = civicrm_api3('Setting', 'getdefaults', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetDefaults
-* and can be found in
+* The test that created it is called "testGetDefaults"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using setting getfields API.
+ * Test Generated example demonstrating the Setting.getfields API.
*
* Demonstrate return from getfields - see subfolder for variants
*
$params = array();
try{
- $result = civicrm_api3('setting', 'getfields', $params);
+ $result = civicrm_api3('Setting', 'getfields', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetFields
-* and can be found in
+* The test that created it is called "testGetFields"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using setting get API.
+ * Test Generated example demonstrating the Setting.get API.
*
* Shows getting a variable for a current domain.
*
);
try{
- $result = civicrm_api3('setting', 'get', $params);
+ $result = civicrm_api3('Setting', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetSetting
-* and can be found in
+* The test that created it is called "testGetSetting"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using setting Get API.
+ * Test Generated example demonstrating the Setting.get API.
*
* Shows getting a variable for specified domains.
*
);
try{
- $result = civicrm_api3('setting', 'Get', $params);
+ $result = civicrm_api3('Setting', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateSettingMultipleDomains
-* and can be found in
+* The test that created it is called "testCreateSettingMultipleDomains"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using setting getvalue API.
+ * Test Generated example demonstrating the Setting.getvalue API.
*
* Demonstrates getvalue action - intended for runtime use as better caching than get.
*
);
try{
- $result = civicrm_api3('setting', 'getvalue', $params);
+ $result = civicrm_api3('Setting', 'getvalue', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetValue
-* and can be found in
+* The test that created it is called "testGetValue"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using setting revert API.
+ * Test Generated example demonstrating the Setting.revert API.
*
* Demonstrates reverting a parameter to default value.
*
);
try{
- $result = civicrm_api3('setting', 'revert', $params);
+ $result = civicrm_api3('Setting', 'revert', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testRevert
-* and can be found in
+* The test that created it is called "testRevert"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using survey get API.
+ * Test Generated example demonstrating the Survey.get API.
*
* Demonstrates get + delete in the same call.
*
);
try{
- $result = civicrm_api3('survey', 'get', $params);
+ $result = civicrm_api3('Survey', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetSurveyChainDelete
-* and can be found in
+* The test that created it is called "testGetSurveyChainDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using survey create API.
+ * Test Generated example demonstrating the Survey.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('survey', 'create', $params);
+ $result = civicrm_api3('Survey', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateSurvey
-* and can be found in
+* The test that created it is called "testCreateSurvey"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using survey delete API.
+ * Test Generated example demonstrating the Survey.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('survey', 'delete', $params);
+ $result = civicrm_api3('Survey', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteSurvey
-* and can be found in
+* The test that created it is called "testDeleteSurvey"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using survey get API.
+ * Test Generated example demonstrating the Survey.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('survey', 'get', $params);
+ $result = civicrm_api3('Survey', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetSurvey
-* and can be found in
+* The test that created it is called "testGetSurvey"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using survey_respondant get API.
+ * Test Generated example demonstrating the SurveyRespondant.get API.
*
* @deprecated
- * The survey_respondant api is not currently supported.
+ * The SurveyRespondant api is not currently supported.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('survey_respondant', 'get', $params);
+ $result = civicrm_api3('SurveyRespondant', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
'version' => 3,
'count' => 0,
'values' => array(),
- 'deprecated' => 'The survey_respondant api is not currently supported.',
+ 'deprecated' => 'The SurveyRespondant api is not currently supported.',
);
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetSurveyRespondants
-* and can be found in
+* The test that created it is called "testGetSurveyRespondants"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyRespondantTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using system flush API.
+ * Test Generated example demonstrating the System.flush API.
*
* Flush all system caches
*
$params = array();
try{
- $result = civicrm_api3('system', 'flush', $params);
+ $result = civicrm_api3('System', 'flush', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testFlush
-* and can be found in
+* The test that created it is called "testFlush"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SystemTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using tag create API.
+ * Test Generated example demonstrating the Tag.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('tag', 'create', $params);
+ $result = civicrm_api3('Tag', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreate
-* and can be found in
+* The test that created it is called "testCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using tag delete API.
+ * Test Generated example demonstrating the Tag.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('tag', 'delete', $params);
+ $result = civicrm_api3('Tag', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testTagDeleteCorrectSyntax
-* and can be found in
+* The test that created it is called "testTagDeleteCorrectSyntax"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using tag get API.
+ * Test Generated example demonstrating the Tag.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('tag', 'get', $params);
+ $result = civicrm_api3('Tag', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGet
-* and can be found in
+* The test that created it is called "testGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using tag getfields API.
+ * Test Generated example demonstrating the Tag.getfields API.
*
* Demonstrate use of getfields to interrogate api.
*
);
try{
- $result = civicrm_api3('tag', 'getfields', $params);
+ $result = civicrm_api3('Tag', 'getfields', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testTagGetfields
-* and can be found in
+* The test that created it is called "testTagGetfields"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using tag getlist API.
+ * Test Generated example demonstrating the Tag.getlist API.
*
* Demonstrates use of api.getlist for autocomplete and quicksearch applications.
*
);
try{
- $result = civicrm_api3('tag', 'getlist', $params);
+ $result = civicrm_api3('Tag', 'getlist', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testTagGetList
-* and can be found in
+* The test that created it is called "testTagGetList"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using tag get API.
+ * Test Generated example demonstrating the Tag.get API.
*
* Demonstrates use of Return as an array.
*
);
try{
- $result = civicrm_api3('tag', 'get', $params);
+ $result = civicrm_api3('Tag', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetReturnArray
-* and can be found in
+* The test that created it is called "testGetReturnArray"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using uf_field create API.
+ * Test Generated example demonstrating the UFField.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('uf_field', 'create', $params);
+ $result = civicrm_api3('UFField', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateUFField
-* and can be found in
+* The test that created it is called "testCreateUFField"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using uf_field delete API.
+ * Test Generated example demonstrating the UFField.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('uf_field', 'delete', $params);
+ $result = civicrm_api3('UFField', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteUFField
-* and can be found in
+* The test that created it is called "testDeleteUFField"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using uf_field get API.
+ * Test Generated example demonstrating the UFField.get API.
*
* @return array
* API result array
$params = array();
try{
- $result = civicrm_api3('uf_field', 'get', $params);
+ $result = civicrm_api3('UFField', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetUFFieldSuccess
-* and can be found in
+* The test that created it is called "testGetUFFieldSuccess"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using uf_field replace API.
+ * Test Generated example demonstrating the UFField.replace API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('uf_field', 'replace', $params);
+ $result = civicrm_api3('UFField', 'replace', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testReplaceUFFields
-* and can be found in
+* The test that created it is called "testReplaceUFFields"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using uf_group create API.
+ * Test Generated example demonstrating the UFGroup.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('uf_group', 'create', $params);
+ $result = civicrm_api3('UFGroup', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testUFGroupCreate
-* and can be found in
+* The test that created it is called "testUFGroupCreate"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFGroupTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using uf_group delete API.
+ * Test Generated example demonstrating the UFGroup.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('uf_group', 'delete', $params);
+ $result = civicrm_api3('UFGroup', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testUFGroupDelete
-* and can be found in
+* The test that created it is called "testUFGroupDelete"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFGroupTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using uf_group get API.
+ * Test Generated example demonstrating the UFGroup.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('uf_group', 'get', $params);
+ $result = civicrm_api3('UFGroup', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testUFGroupGet
-* and can be found in
+* The test that created it is called "testUFGroupGet"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFGroupTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using uf_join create API.
+ * Test Generated example demonstrating the UFJoin.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('uf_join', 'create', $params);
+ $result = civicrm_api3('UFJoin', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateUFJoin
-* and can be found in
+* The test that created it is called "testCreateUFJoin"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFJoinTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using uf_join get API.
+ * Test Generated example demonstrating the UFJoin.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('uf_join', 'get', $params);
+ $result = civicrm_api3('UFJoin', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetUFJoinId
-* and can be found in
+* The test that created it is called "testGetUFJoinId"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFJoinTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using uf_match get API.
+ * Test Generated example demonstrating the UFMatch.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('uf_match', 'get', $params);
+ $result = civicrm_api3('UFMatch', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetUFID
-* and can be found in
+* The test that created it is called "testGetUFID"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFMatchTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using website create API.
+ * Test Generated example demonstrating the Website.create API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('website', 'create', $params);
+ $result = civicrm_api3('Website', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateWebsite
-* and can be found in
+* The test that created it is called "testCreateWebsite"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using website delete API.
+ * Test Generated example demonstrating the Website.delete API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('website', 'delete', $params);
+ $result = civicrm_api3('Website', 'delete', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testDeleteWebsite
-* and can be found in
+* The test that created it is called "testDeleteWebsite"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using website get API.
+ * Test Generated example demonstrating the Website.get API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('website', 'get', $params);
+ $result = civicrm_api3('Website', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetWebsite
-* and can be found in
+* The test that created it is called "testGetWebsite"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using website getfields API.
+ * Test Generated example demonstrating the Website.getfields API.
*
* @return array
* API result array
);
try{
- $result = civicrm_api3('website', 'getfields', $params);
+ $result = civicrm_api3('Website', 'getfields', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetFields
-* and can be found in
+* The test that created it is called "testGetFields"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php
*
* You can see the outcome of the API tests at
<?php
/**
- * Test Generated example of using website get API.
+ * Test Generated example demonstrating the Website.get API.
*
* Demonostrates returning field metadata
*
);
try{
- $result = civicrm_api3('website', 'get', $params);
+ $result = civicrm_api3('Website', 'get', $params);
}
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* testGetMetadata
-* and can be found in
+* The test that created it is called "testGetMetadata"
+* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php
*
* You can see the outcome of the API tests at
* @param string $file
* Pass this in to create a generated example.
* @param string $description
- * @param string|null $subfile
- * @param string|null $actionName
+ * @param string|null $exampleName
+ *
* @return array|int
*/
- public function callAPIAndDocument($entity, $action, $params, $function, $file, $description = "", $subfile = NULL, $actionName = NULL) {
+ public function callAPIAndDocument($entity, $action, $params, $function, $file, $description = "", $exampleName = NULL) {
$params['version'] = $this->_apiversion;
$result = $this->callAPISuccess($entity, $action, $params);
- $this->documentMe($params, $result, $function, $file, $description, $subfile, $actionName);
+ $this->documentMe($entity, $action, $params, $result, $function, $file, $description, $exampleName);
return $result;
}
* define(DONT_DOCUMENT_TEST_CONFIG ,1);
* in your settings file
*
+ * @param string $entity
+ * @param string $action
* @param array $params
* Array as passed to civicrm_api function.
* @param array $result
* Array as received from the civicrm_api function.
- * @param string $function
+ * @param string $testFunction
* Calling function - generally __FUNCTION__.
- * @param string $filename
+ * @param string $testFile
* Called from file - generally __FILE__.
* @param string $description
* Descriptive text for the example file.
- * @param string $subfile
- * Name for subfile - if this is completed the example will be put in a subfolder (named by the entity).
- * @param string $action
- * Optional action - otherwise taken from function name.
+ * @param string $exampleName
+ * Name for this example file (CamelCase) - if ommitted the action name will be substituted.
*/
- public function documentMe($params, $result, $function, $filename, $description = "", $subfile = NULL, $action = NULL) {
+ private function documentMe($entity, $action, $params, $result, $testFunction, $testFile, $description = "", $exampleName = NULL) {
if (defined('DONT_DOCUMENT_TEST_CONFIG') && DONT_DOCUMENT_TEST_CONFIG) {
return;
}
- $entity = substr(basename($filename), 0, strlen(basename($filename)) - 8);
- //todo - this is a bit cludgey
- if (empty($action)) {
- if (strstr($function, 'Create')) {
- $action = empty($action) ? 'create' : $action;
- $entityAction = 'Create';
- }
- elseif (strstr($function, 'GetSingle')) {
- $action = empty($action) ? 'getsingle' : $action;
- $entityAction = 'GetSingle';
- }
- elseif (strstr($function, 'GetValue')) {
- $action = empty($action) ? 'getvalue' : $action;
- $entityAction = 'GetValue';
- }
- elseif (strstr($function, 'GetCount')) {
- $action = empty($action) ? 'getcount' : $action;
- $entityAction = 'GetCount';
- }
- elseif (strstr($function, 'GetFields')) {
- $action = empty($action) ? 'getfields' : $action;
- $entityAction = 'GetFields';
- }
- elseif (strstr($function, 'GetList')) {
- $action = empty($action) ? 'getlist' : $action;
- $entityAction = 'GetList';
- }
- elseif (strstr($function, 'GetActions')) {
- $action = empty($action) ? 'getactions' : $action;
- $entityAction = 'GetActions';
- }
- elseif (strstr($function, 'Get')) {
- $action = empty($action) ? 'get' : $action;
- $entityAction = 'Get';
- }
- elseif (strstr($function, 'Delete')) {
- $action = empty($action) ? 'delete' : $action;
- $entityAction = 'Delete';
- }
- elseif (strstr($function, 'Update')) {
- $action = empty($action) ? 'update' : $action;
- $entityAction = 'Update';
- }
- elseif (strstr($function, 'Subscribe')) {
- $action = empty($action) ? 'subscribe' : $action;
- $entityAction = 'Subscribe';
- }
- elseif (strstr($function, 'Submit')) {
- $action = empty($action) ? 'submit' : $action;
- $entityAction = 'Submit';
- }
- elseif (strstr($function, 'Apply')) {
- $action = empty($action) ? 'apply' : $action;
- $entityAction = 'Apply';
- }
- elseif (strstr($function, 'Replace')) {
- $action = empty($action) ? 'replace' : $action;
- $entityAction = 'Replace';
+ $entity = _civicrm_api_get_camel_name($entity);
+ $action = strtolower($action);
+
+ if (empty($exampleName)) {
+ // Attempt to convert lowercase action name to CamelCase.
+ // This is clunky/imperfect due to the convention of all lowercase actions.
+ $exampleName = CRM_Utils_String::convertStringToCamel($action);
+ $knownPrefixes = array(
+ 'Get',
+ 'Set',
+ 'Create',
+ 'Update',
+ 'Send',
+ );
+ foreach ($knownPrefixes as $prefix) {
+ if (strpos($exampleName, $prefix) === 0 && $prefix != $exampleName) {
+ $exampleName[strlen($prefix)] = strtoupper($exampleName[strlen($prefix)]);
+ }
}
}
- else {
- $entityAction = ucwords($action);
- }
$this->tidyExampleResult($result);
if (isset($params['version'])) {
unset($params['version']);
}
- // a cleverer person than me would do it in a single regex
- if (strstr($entity, 'UF')) {
- $fnPrefix = strtolower(preg_replace('/(?<! )(?<!^)(?<=UF)[A-Z]/', '_$0', $entity));
- }
- else {
- $fnPrefix = strtolower(preg_replace('/(?<! )(?<!^)[A-Z]/', '_$0', $entity));
- }
// Format multiline description as array
$desc = array();
if (is_string($description) && strlen($description)) {
}
}
$smarty = CRM_Core_Smarty::singleton();
- $smarty->assign('testfunction', $function);
- $function = $fnPrefix . "_" . strtolower($action);
- $smarty->assign('function', $function);
- $smarty->assign('fnPrefix', $fnPrefix);
+ $smarty->assign('testFunction', $testFunction);
+ $smarty->assign('function', _civicrm_api_get_entity_name_from_camel($entity) . "_$action");
$smarty->assign('params', $params);
$smarty->assign('entity', $entity);
- $smarty->assign('filename', basename($filename));
+ $smarty->assign('testFile', basename($testFile));
$smarty->assign('description', $desc);
$smarty->assign('result', $result);
-
$smarty->assign('action', $action);
- if (empty($subfile)) {
- $subfile = $entityAction;
- }
+
if (file_exists('../tests/templates/documentFunction.tpl')) {
if (!is_dir("../api/v3/examples/$entity")) {
mkdir("../api/v3/examples/$entity");
}
- $f = fopen("../api/v3/examples/$entity/$subfile.php", "w+b");
+ $f = fopen("../api/v3/examples/$entity/$exampleName.php", "w+b");
fwrite($f, $smarty->fetch('../tests/templates/documentFunction.tpl'));
fclose($f);
}
$params = $this->_params;
$params['custom_' . $customField['id']] = "$this->_contactID";
- $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, $description, $subfile, 'Create');
+ $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
$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');
+ ), __FUNCTION__, __FILE__, 'Get with Contact Ref Custom Field', 'ContactRefCustomFieldGet');
$this->assertEquals('Anderson, Anthony', $result['values'][$result['id']]['custom_' . $customField['id']]);
$this->assertEquals($this->_contactID, $result['values'][$result['id']]['custom_' . $customField['id'] . "_id"], ' in line ' . __LINE__);
*/
public function testActivityGetGoodID1() {
// Insert rows in civicrm_activity creating activities 4 and 13
- $description = "Demonstrates getting asignee_contact_id & using it to get the contact.";
+ $description = "Demonstrates getting assignee_contact_id & using it to get the contact.";
$subfile = 'ReturnAssigneeContact';
$activity = $this->callAPISuccess('activity', 'create', $this->_params);
'version' => $this->_apiversion,
);
- $result = $this->callAPISuccess('activity', 'delete', $params);
- $this->documentMe($params, $result, __FUNCTION__, __FILE__);
+ $this->callAPIAndDocument('activity', 'delete', $params, __FUNCTION__, __FILE__);
}
/**
*/
public function testGetFields() {
$params = array('action' => 'create');
- $result = $this->callAPIAndDocument('activity', 'getfields', $params, __FUNCTION__, __FILE__, NULL, NULL, 'getfields');
+ $result = $this->callAPIAndDocument('activity', 'getfields', $params, __FUNCTION__, __FILE__, NULL, NULL);
$this->assertTrue(is_array($result['values']), 'get fields doesn\'t return values array');
foreach ($result['values'] as $key => $value) {
$this->assertTrue(is_array($value), $key . " is not an array");
$params = array(
'field' => 'location_type_id',
);
- $result = $this->callAPISuccess('address', 'getoptions', $params);
+ $result = $this->callAPIAndDocument('address', 'getoptions', $params, __FUNCTION__, __FILE__);
$this->assertTrue($result['count'] > 3, "In line " . __LINE__);
$this->assertContains('Home', $result['values'], "In line " . __LINE__);
$this->assertContains('Work', $result['values'], "In line " . __LINE__);
$params = array(
'field' => 'phone_type_id',
);
- $result = $this->callAPISuccess('phone', 'getoptions', $params);
+ $result = $this->callAPIAndDocument('phone', 'getoptions', $params, __FUNCTION__, __FILE__);
$this->assertEquals(5, $result['count'], "In line " . __LINE__);
$this->assertContains('Phone', $result['values'], "In line " . __LINE__);
$params = array(
'field' => 'protocol',
);
- $result = $this->callAPISuccess('mail_settings', 'getoptions', $params);
+ $result = $this->callAPIAndDocument('mail_settings', 'getoptions', $params, __FUNCTION__, __FILE__);
$this->assertEquals(4, $result['count'], "In line " . __LINE__);
$this->assertContains('IMAP', $result['values'], "In line " . __LINE__);
It will be ignored if there is not exactly 1 result";
$subFile = "FormatSingleValue";
$params = array('id' => 17, 'return' => 'display_name');
- $result = $this->callAPIAndDocument('Contact', 'getvalue', $params, __FUNCTION__, __FILE__, $description, $subFile, 'getvalue');
+ $result = $this->callAPIAndDocument('Contact', 'getvalue', $params, __FUNCTION__, __FILE__, $description, $subFile);
$this->assertEquals('Test Contact', $result);
$this->callAPISuccess('Contact', 'Delete', $params);
}
);
- $this->callAPIAndDocument('contribution_page', 'submit', $submitParams, __FUNCTION__, __FILE__, 'submit contribution page', NULL, 'Submit');
+ $this->callAPIAndDocument('contribution_page', 'submit', $submitParams, __FUNCTION__, __FILE__, 'submit contribution page', NULL);
$contribution = $this->callAPISuccess('contribution', 'getsingle', array('contribution_page_id' => $this->_ids['contribution_page']));
$this->callAPISuccess('membership_payment', 'getsingle', array('contribution_id' => $contribution['id']));
}
'selectMembership' => $this->_ids['membership_type'],
);
- $this->callAPIAndDocument('contribution_page', 'submit', $submitParams, __FUNCTION__, __FILE__, 'submit contribution page', NULL, 'Submit');
+ $this->callAPIAndDocument('contribution_page', 'submit', $submitParams, __FUNCTION__, __FILE__, 'submit contribution page', NULL);
$contributions = $this->callAPISuccess('contribution', 'get', array('contribution_page_id' => $this->_ids['contribution_page']));
$this->assertCount(2, $contributions['values']);
$membershipPayment = $this->callAPISuccess('membership_payment', 'getsingle', array());
'selectMembership' => $this->_ids['membership_type'][1],
);
- $this->callAPIAndDocument('contribution_page', 'submit', $submitParams, __FUNCTION__, __FILE__, 'submit contribution page', NULL, 'Submit');
+ $this->callAPIAndDocument('contribution_page', 'submit', $submitParams, __FUNCTION__, __FILE__, 'submit contribution page', NULL);
$contributions = $this->callAPISuccess('contribution', 'get', array('contribution_page_id' => $this->_ids['contribution_page']));
$this->assertCount(2, $contributions['values']);
$ids = array_keys($contributions['values']);
'cvv2' => 123,
);
- $this->callAPIAndDocument('contribution_page', 'submit', $submitParams, __FUNCTION__, __FILE__, 'submit contribution page', NULL, 'Submit');
+ $this->callAPIAndDocument('contribution_page', 'submit', $submitParams, __FUNCTION__, __FILE__, 'submit contribution page', NULL);
$contributions = $this->callAPISuccess('contribution', 'get', array(
'contribution_page_id' => $this->_ids['contribution_page'],
'contribution_status_id' => 1,
'frequency_unit' => 'month',
);
- $this->callAPIAndDocument('contribution_page', 'submit', $submitParams, __FUNCTION__, __FILE__, 'submit contribution page', NULL, 'Submit');
+ $this->callAPIAndDocument('contribution_page', 'submit', $submitParams, __FUNCTION__, __FILE__, 'submit contribution page', NULL);
$contribution = $this->callAPISuccess('contribution', 'getsingle', array(
'contribution_page_id' => $this->_ids['contribution_page'],
'contribution_status_id' => 1,
'frequency_unit' => 'month',
);
- $this->callAPIAndDocument('contribution_page', 'submit', $submitParams, __FUNCTION__, __FILE__, 'submit contribution page', NULL, 'Submit');
+ $this->callAPIAndDocument('contribution_page', 'submit', $submitParams, __FUNCTION__, __FILE__, 'submit contribution page', NULL);
$contribution = $this->callAPISuccess('contribution', 'getsingle', array(
'contribution_page_id' => $this->_ids['contribution_page'],
'contribution_status_id' => 2,
);
$description = "Demonstrates retrieving metadata with custom field options.";
$subfile = "GetFieldsOptions";
- $fields = $this->callAPIAndDocument('contact', 'getfields', $getFieldsParams, __FUNCTION__, 'ContactTest.php', $description, $subfile, 'GetFields');
+ $fields = $this->callAPIAndDocument('contact', 'getfields', $getFieldsParams, __FUNCTION__, 'ContactTest.php', $description, $subfile);
$this->assertArrayHasKey('options', $fields['values']['custom_' . $customField['id']]);
$this->assertEquals('Label1', $fields['values']['custom_' . $customField['id']]['options'][1]);
$getOptionsArray = array(
);
$description = "Demonstrates retrieving options for a custom field.";
$subfile = "GetOptions";
- $result = $this->callAPIAndDocument('contact', 'getoptions', $getOptionsArray, __FUNCTION__, 'ContactTest.php', $description, '', 'getoptions');
+ $result = $this->callAPIAndDocument('contact', 'getoptions', $getOptionsArray, __FUNCTION__, 'ContactTest.php', $description, '');
$this->assertEquals('Label1', $result['values'][1]);
}
$result = $this->callAPIAndDocument('CustomValue', 'Get', $params, __FUNCTION__, __FILE__, $description);
$params['format.field_names'] = 1;
- $resultformatted = $this->callAPIAndDocument('CustomValue', 'Get', $params, __FUNCTION__, __FILE__, "utilises field names", 'formatFieldName');
+ $resultformatted = $this->callAPIAndDocument('CustomValue', 'Get', $params, __FUNCTION__, __FILE__, "utilises field names", 'FormatFieldName');
// delete the contact
$this->callAPISuccess('contact', 'delete', array('id' => $contact_id));
$this->assertEquals('coffee', $result['values'][$secondCustomField]['2']);
'tag_id' => $this->_tagID,
);
- $result = $this->callAPIAndDocument('entity_tag', 'create', $params, __FUNCTION__, __FILE__);
+ $result = $this->callAPISuccess('entity_tag', 'create', $params, __FUNCTION__, __FILE__);
$this->assertEquals($result['added'], 1);
}
$paramsEntity = array(
'contact_id' => $contactId,
);
- $entity = $this->callAPISuccess('entity_tag', 'get', $paramsEntity);
+ $entity = $this->callAPIAndDocument('entity_tag', 'get', $paramsEntity, __FUNCTION__, __FILE__);
}
public function testHouseholdEntityGet() {
'contact_id' => $contactID,
'event_id' => $this->_eventIds[0],
));
- $currentEvent = $this->callAPIAndDocument('Event', 'getsingle', $getEventParams, __FUNCTION__, __FILE__, $description, $subfile, 'getsingle');
+ $currentEvent = $this->callAPIAndDocument('Event', 'getsingle', $getEventParams, __FUNCTION__, __FILE__, $description, $subfile);
$this->assertEquals(1, $currentEvent['is_full'], ' is full is set in line ' . __LINE__);
$this->assertEquals(0, $currentEvent['available_places'], 'available places is set in line ' . __LINE__);
public function testgetfields() {
$description = "Demonstrate use of getfields to interrogate api.";
$params = array('action' => 'create');
- $result = $this->callAPIAndDocument('group', 'getfields', $params, __FUNCTION__, __FILE__, $description, 'getfields', 'getfields');
+ $result = $this->callAPIAndDocument('group', 'getfields', $params, __FUNCTION__, __FILE__, $description);
$this->assertEquals(1, $result['values']['is_active']['api.default']);
}
'email_id' => $email['id'],
);
$description = 'Create locBlock with existing entities';
- $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, $description, 'simpleCreate');
+ $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, $description);
$id = $result['id'];
$this->assertEquals(1, $result['count']);
$this->assertNotNull($result['values'][$id]['id']);
),
);
$description = "Create entities and locBlock in 1 api call.";
- $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, $description, 'createEntities');
+ $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, $description, 'CreateEntities');
$id = $result['id'];
$this->assertEquals(1, $result['count']);
'return' => 'all',
);
// Can't use callAPISuccess with getsingle.
- $result = $this->callAPIAndDocument($this->_entity, 'get', $getParams, __FUNCTION__, __FILE__, 'Get entities and location block in 1 api call', 'getEntities', 'get');
+ $result = $this->callAPIAndDocument($this->_entity, 'get', $getParams, __FUNCTION__, __FILE__, 'Get entities and location block in 1 api call');
$result = array_pop($result['values']);
$this->assertNotNull($result['email_id']);
$this->assertNotNull($result['phone_id']);
public function testGetOnlyActive() {
$description = "Demonstrates use of 'filter' active_only' param.";
$this->_membershipID = $this->contactMembershipCreate($this->_params);
- $subfile = 'filterIsCurrent';
$params = array(
'contact_id' => $this->_contactID,
'active_only' => 1,
),
);
- $membership = $this->callAPIAndDocument('membership', 'get', $params, __FUNCTION__, __FILE__, $description, $subfile);
+ $membership = $this->callAPIAndDocument('membership', 'get', $params, __FUNCTION__, __FILE__, $description, 'FilterIsCurrent');
$this->assertEquals($membership['values'][$this->_membershipID]['status_id'], $this->_membershipStatusID);
$this->assertEquals($membership['values'][$this->_membershipID]['contact_id'], $this->_contactID);
$params = $this->_params;
$params['custom_' . $ids['custom_field_id']] = "custom string";
- $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__);
+ $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, NULL, 'CreateWithCustomData');
$check = $this->callAPISuccess($this->_entity, 'get', array(
'id' => $result['id'],
'contact_id' => $this->_contactID,
$params = $this->_params;
$params['custom_' . $ids['custom_field_id']] = "custom string";
- $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__);
+ $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, NULL, 'UpdateCustomData');
$result = $this->callAPISuccess($this->_entity, 'create', array(
'id' => $result['id'],
'custom_' . $ids['custom_field_id'] => "new custom",
$participants = $this->callAPISuccess('Participant', 'Get', array());
$this->assertEquals($participants['count'], 3);
$params = array('contact_id' => $this->_contactID2, 'api.participant.delete' => 1);
- $participants = $this->callAPIAndDocument('Participant', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile, 'Get');
+ $participants = $this->callAPIAndDocument('Participant', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile);
$check = $this->callAPISuccess('participant', 'getcount', array());
$this->assertEquals(1, $check, "only one participant should be left. line " . __LINE__);
}
);
// we'll check it with a 'get'
$description = "Shows getting a variable for all domains.";
- $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__, $description, 'GetAllDomains', 'Get');
+ $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__, $description, 'GetAllDomains');
$this->assertEquals(1, $result['values'][2]['uniq_email_per_site']);
$this->assertEquals(1, $result['values'][1]['uniq_email_per_site']);
'return' => array('uniq_email_per_site'),
);
$description = "Shows getting a variable for specified domains.";
- $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__, $description, 'GetSpecifiedDomains', 'Get');
+ $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__, $description, 'GetSpecifiedDomains');
$this->assertEquals(1, $result['values'][2]['uniq_email_per_site']);
$this->assertEquals(0, $result['values'][1]['uniq_email_per_site']);
$params = array(
'name' => 'address_format',
);
- $result = $this->callAPIAndDocument('setting', 'getdefaults', $params, __FUNCTION__, __FILE__, $description, 'GetDefaults', 'getdefaults');
+ $result = $this->callAPIAndDocument('setting', 'getdefaults', $params, __FUNCTION__, __FILE__, $description, 'GetDefaults');
$this->assertEquals("{contact.address_name}\n{contact.street_address}\n{contact.supplemental_address_1}\n{contact.supplemental_address_2}\n{contact.city}{, }{contact.state_province}{ }{contact.postal_code}\n{contact.country}", $result['values'][CRM_Core_Config::domainID()]['address_format']);
$params = array('name' => 'mailing_format');
$result = $this->callAPISuccess('setting', 'getdefaults', $params);
//make sure it's set
$this->assertEquals('xyz', $result['values'][CRM_Core_Config::domainID()]['address_format']);
$description = "Demonstrates reverting a parameter to default value.";
- $result = $this->callAPIAndDocument('setting', 'revert', $revertParams, __FUNCTION__, __FILE__, $description, '', 'revert');
+ $result = $this->callAPIAndDocument('setting', 'revert', $revertParams, __FUNCTION__, __FILE__, $description, '');
//make sure it's reverted
$result = $this->callAPISuccess('setting', 'get', $params);
$this->assertEquals("{contact.address_name}\n{contact.street_address}\n{contact.supplemental_address_1}\n{contact.supplemental_address_2}\n{contact.city}{, }{contact.state_province}{ }{contact.postal_code}\n{contact.country}", $result['values'][CRM_Core_Config::domainID()]['address_format']);
$this->assertEquals('abc', CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH));
$params = array();
- $result = $this->callAPIAndDocument('system', 'flush', $params, __FUNCTION__, __FILE__, "Flush all system caches", 'Flush', 'flush');
+ $result = $this->callAPIAndDocument('system', 'flush', $params, __FUNCTION__, __FILE__, "Flush all system caches", 'Flush');
$this->assertTrue(NULL === CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH));
}
*/
public function testGetReturnArray() {
$description = "Demonstrates use of Return as an array.";
- $subfile = "getReturnArray";
+ $subfile = "GetReturnArray";
$params = array(
'id' => $this->tagID,
public function testTagGetfields() {
$description = "Demonstrate use of getfields to interrogate api.";
$params = array('action' => 'create');
- $result = $this->callAPIAndDocument('tag', 'getfields', $params, __FUNCTION__, __FILE__, $description, NULL, 'getfields');
+ $result = $this->callAPIAndDocument('tag', 'getfields', $params, __FUNCTION__, __FILE__, $description, NULL);
$this->assertEquals('civicrm_contact', $result['values']['used_for']['api.default']);
}
{literal}<?php{/literal}
/**
- * Test Generated example of using {$fnPrefix} {$action} API.
+ * Test Generated example demonstrating the {$entity}.{$action} API.
*
{if !empty($result.deprecated) && is_string($result.deprecated)}
* @deprecated
$params = {$params|@print_array};
{literal}
try{{/literal}
- $result = civicrm_api3('{$fnPrefix}', '{$action}', $params);
+ $result = civicrm_api3('{$entity}', '{$action}', $params);
{literal} }
catch (CiviCRM_API3_Exception $e) {
// Handle error here.
return $expectedResult;
{literal}}{/literal}
-/**
+/*
* This example has been generated from the API test suite.
-* The test that created it is called
-* {$testfunction}
-* and can be found in
-* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/{$filename}
+* The test that created it is called "{$testFunction}"
+* and can be found at:
+* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/{$testFile}
*
* You can see the outcome of the API tests at
* https://test.civicrm.org/job/CiviCRM-master-git/