<?php
-
-/*
- demonstrates create with Contact Reference Custom Field
+/**
+ * Test Generated example of using activity create API
+ * demonstrates create with Contact Reference Custom Field *
*/
function activity_create_example(){
$params = array(
'duration' => 120,
'location' => 'Pensulvania',
'details' => 'a test activity',
- 'version' => 3,
'custom_2' => '17',
);
- $result = civicrm_api( 'activity','create',$params );
+try{
+ $result = civicrm_api3('activity', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function activity_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Get with Contact Ref Custom Field
+/**
+ * Test Generated example of using activity create API
+ * Get with Contact Ref Custom Field *
*/
function activity_create_example(){
$params = array(
'duration' => 120,
'location' => 'Pensulvania',
'details' => 'a test activity',
- 'version' => 3,
'custom_2' => '17',
);
- $result = civicrm_api( 'activity','create',$params );
+try{
+ $result = civicrm_api3('activity', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function activity_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- demonstrates _high filter (at time of writing doesn't work if contact_id is set
+/**
+ * Test Generated example of using activity get API
+ * demonstrates _high filter (at time of writing doesn't work if contact_id is set *
*/
function activity_get_example(){
$params = array(
'source_contact_id' => 17,
- 'version' => 3,
'filter.activity_date_time_high' => '20120101000000',
'sequential' => 1,
);
- $result = civicrm_api( 'activity','get',$params );
+try{
+ $result = civicrm_api3('activity', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function activity_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- demonstrates _low filter (at time of writing doesn't work if contact_id is set
+/**
+ * Test Generated example of using activity get API
+ * demonstrates _low filter (at time of writing doesn't work if contact_id is set *
*/
function activity_get_example(){
$params = array(
- 'version' => 3,
'filter.activity_date_time_low' => '20120101000000',
'sequential' => 1,
);
- $result = civicrm_api( 'activity','get',$params );
+try{
+ $result = civicrm_api3('activity', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function activity_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Example demonstrates setting & retrieving the target & source
+/**
+ * Test Generated example of using activity API
+ * Example demonstrates setting & retrieving the target & source *
*/
function activity__example(){
$params = array(
'details' => 'a test activity',
'status_id' => 1,
'activity_type_id' => 1,
- 'version' => 3,
'priority_id' => 1,
'target_contact_id' => 17,
'assignee_contact_id' => 17,
);
- $result = civicrm_api( 'activity','',$params );
+try{
+ $result = civicrm_api3('activity', '', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function activity__expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Function demonstrates getting asignee_contact_id & using it to get the contact
+/**
+ * Test Generated example of using activity get API
+ * Function demonstrates getting asignee_contact_id & using it to get the contact *
*/
function activity_get_example(){
$params = array(
'activity_id' => 1,
- 'version' => 3,
'sequential' => 1,
'return.assignee_contact_id' => 1,
'api.contact.get' => array(
),
);
- $result = civicrm_api( 'activity','get',$params );
+try{
+ $result = civicrm_api3('activity', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function activity_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using activity create API
+ * *
*/
function activity_create_example(){
$params = array(
'duration' => 120,
'location' => 'Pensulvania',
'details' => 'a test activity',
- 'version' => 3,
'custom_1' => 'custom string',
);
- $result = civicrm_api( 'activity','create',$params );
+try{
+ $result = civicrm_api3('activity', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function activity_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using activity delete API
+ * *
*/
function activity_delete_example(){
$params = array(
'id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'activity','delete',$params );
+try{
+ $result = civicrm_api3('activity', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function activity_delete_expectedresult(){
'values' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using activity get API
+ * *
*/
function activity_get_example(){
$params = array(
'contact_id' => 17,
'activity_type_id' => '46',
- 'version' => 3,
'sequential' => 1,
'return.custom_1' => 1,
);
- $result = civicrm_api( 'activity','get',$params );
+try{
+ $result = civicrm_api3('activity', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function activity_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using activity getfields API
+ * *
*/
function activity_getfields_example(){
$params = array(
- 'version' => 3,
'action' => 'create',
);
- $result = civicrm_api( 'activity','getfields',$params );
+try{
+ $result = civicrm_api3('activity', 'getfields', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function activity_getfields_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using activity_type create API
+ * *
*/
function activity_type_create_example(){
$params = array(
'weight' => '2',
'label' => 'send out letters',
- 'version' => 3,
'filter' => 0,
'is_active' => 1,
'is_optgroup' => 1,
'is_default' => 0,
);
- $result = civicrm_api( 'activity_type','create',$params );
+try{
+ $result = civicrm_api3('activity_type', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function activity_type_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using activity_type get API
+ * *
*/
function activity_type_get_example(){
-$params = array(
- 'version' => 3,
-);
+$params = array();
- $result = civicrm_api( 'activity_type','get',$params );
+try{
+ $result = civicrm_api3('activity_type', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function activity_type_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Demonstrates Use of Like
+/**
+ * Test Generated example of using address get API
+ * Demonstrates Use of Like *
*/
function address_get_example(){
$params = array(
'street_address' => array(
'LIKE' => '%mb%',
),
- 'version' => 3,
'sequential' => 1,
);
- $result = civicrm_api( 'address','get',$params );
+try{
+ $result = civicrm_api3('address', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function address_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Demonstrates Use of address parsing param
+/**
+ * Test Generated example of using address create API
+ * Demonstrates Use of address parsing param *
*/
function address_create_example(){
$params = array(
- 'version' => 3,
'street_parsing' => 1,
'street_address' => '54A Excelsior Ave. Apt 1C',
'location_type_id' => 7,
'contact_id' => 4,
);
- $result = civicrm_api( 'address','create',$params );
+try{
+ $result = civicrm_api3('address', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function address_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Demonstrates Use of sort filter
+/**
+ * Test Generated example of using address get API
+ * Demonstrates Use of sort filter *
*/
function address_get_example(){
$params = array(
'sort' => 'street_address DESC',
'limit' => 2,
),
- 'version' => 3,
'sequential' => 1,
);
- $result = civicrm_api( 'address','get',$params );
+try{
+ $result = civicrm_api3('address', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function address_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using address create API
+ * *
*/
function address_create_example(){
$params = array(
'country_id' => '1152',
'city' => 'Brummen',
'is_primary' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'address','create',$params );
+try{
+ $result = civicrm_api3('address', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function address_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using address delete API
+ * *
*/
function address_delete_example(){
$params = array(
- 'contact_id' => 8,
- 'location_type_id' => 11,
- 'street_name' => 'Ambachtstraat',
- 'street_number' => '23',
- 'street_address' => 'Ambachtstraat 23',
- 'postal_code' => '6971 BN',
- 'country_id' => '1152',
- 'city' => 'Brummen',
- 'is_primary' => 1,
- 'version' => 3,
+ 'id' => 6,
);
- $result = civicrm_api( 'address','delete',$params );
+try{
+ $result = civicrm_api3('address', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function address_delete_expectedresult(){
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using address get API
+ * *
*/
function address_get_example(){
$params = array(
'contact_id' => 9,
'street_name' => 'Ambachtstraat',
- 'version' => 3,
);
- $result = civicrm_api( 'address','get',$params );
+try{
+ $result = civicrm_api3('address', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function address_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using batch create API
+ * *
*/
function batch_create_example(){
$params = array(
'total' => '300.33',
'item_count' => 3,
'status_id' => 1,
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'batch','create',$params );
+try{
+ $result = civicrm_api3('batch', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function batch_create_expectedresult(){
'title' => 'New Batch 03',
'description' => 'This is description for New Batch 03',
'created_id' => '',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'modified_id' => '',
'modified_date' => '2012-11-14 16:02:35',
'saved_search_id' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using batch delete API
+ * *
*/
function batch_delete_example(){
$params = array(
'id' => 1,
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'batch','delete',$params );
+try{
+ $result = civicrm_api3('batch', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function batch_delete_expectedresult(){
'values' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using batch get API
+ * *
*/
function batch_get_example(){
$params = array(
'id' => 1,
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'batch','get',$params );
+try{
+ $result = civicrm_api3('batch', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function batch_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using batch update API
+ * *
*/
function batch_update_example(){
$params = array(
'total' => '400.44',
'item_count' => 4,
'id' => 1,
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'batch','update',$params );
+try{
+ $result = civicrm_api3('batch', 'update', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function batch_update_expectedresult(){
'title' => 'New Batch 04',
'description' => 'This is description for New Batch 04',
'created_id' => '',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'modified_id' => '',
'modified_date' => '2012-11-14 16:02:35',
'saved_search_id' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Create a campaign - Note use of relative dates here http://www.php.net/manual/en/datetime.formats.relative.php
+/**
+ * Test Generated example of using campaign create API
+ * Create a campaign - Note use of relative dates here http://www.php.net/manual/en/datetime.formats.relative.php *
*/
function campaign_create_example(){
$params = array(
- 'version' => 3,
'title' => 'campaign title',
'description' => 'Call people, ask for money',
'created_date' => 'first sat of July 2008',
);
- $result = civicrm_api( 'campaign','create',$params );
+try{
+ $result = civicrm_api3('campaign', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function campaign_create_expectedresult(){
'parent_id' => '',
'is_active' => '',
'created_id' => '',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'last_modified_id' => '',
'last_modified_date' => '',
'goal_general' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using campaign delete API
+ * *
*/
function campaign_delete_example(){
$params = array(
- 'version' => 3,
'id' => 2,
);
- $result = civicrm_api( 'campaign','delete',$params );
+try{
+ $result = civicrm_api3('campaign', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function campaign_delete_expectedresult(){
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using campaign get API
+ * *
*/
function campaign_get_example(){
$params = array(
- 'version' => 3,
'title' => 'campaign title',
'description' => 'Call people, ask for money',
'created_date' => 'first sat of July 2008',
);
- $result = civicrm_api( 'campaign','get',$params );
+try{
+ $result = civicrm_api3('campaign', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function campaign_get_expectedresult(){
'title' => 'campaign title',
'description' => 'Call people, ask for money',
'is_active' => '1',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using constant get API
+ * *
*/
function constant_get_example(){
$params = array(
'field' => 'location_type_id',
- 'version' => 3,
);
- $result = civicrm_api( 'constant','get',$params );
+try{
+ $result = civicrm_api3('constant', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function constant_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- /*this demonstrates the usage of chained api functions. In this case no notes or custom fields have been created
+/**
+ * Test Generated example of using contact get API
+ * /*this demonstrates the usage of chained api functions. In this case no notes or custom fields have been created *
*/
function contact_get_example(){
$params = array(
'id' => 1,
- 'version' => 3,
'api.website.get' => array(),
'api.Contribution.get' => array(
'total_amount' => '120.00',
'api.Note.get' => 1,
);
- $result = civicrm_api( 'contact','get',$params );
+try{
+ $result = civicrm_api3('contact', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- /*this demonstrates the usage of chained api functions. A variety of return formats are used. Note that no notes
- *custom fields or memberships exist
+/**
+ * Test Generated example of using contact get API
+ * /*this demonstrates the usage of chained api functions. A variety of return formats are used. Note that no notes
+ *custom fields or memberships exist *
*/
function contact_get_example(){
$params = array(
'id' => 1,
- 'version' => 3,
'api.website.getValue' => array(
'return' => 'url',
),
'api.Membership.getCount' => array(),
);
- $result = civicrm_api( 'contact','get',$params );
+try{
+ $result = civicrm_api3('contact', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- /*this demonstrates the usage of chained api functions. A variety of techniques are used
+/**
+ * Test Generated example of using contact get API
+ * /*this demonstrates the usage of chained api functions. A variety of techniques are used *
*/
function contact_get_example(){
$params = array(
'id' => 1,
- 'version' => 3,
'api.website.getValue' => array(
'return' => 'url',
),
'api.CustomValue.get' => 1,
);
- $result = civicrm_api( 'contact','get',$params );
+try{
+ $result = civicrm_api3('contact', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_get_expectedresult(){
'api.CustomValue.get' => array(
'is_error' => 0,
'version' => 3,
- 'count' => 10,
+ 'count' => 8,
'values' => array(
'0' => array(
'entity_id' => '1',
'latest' => 'value 4',
- 'id' => '13',
- '0' => 'value 4',
+ 'id' => '1',
+ 'entity_table' => 'Contact',
),
'1' => array(
'entity_table' => 'Contact',
'2' => array(
'entity_id' => '1',
'latest' => 'value 3',
- 'id' => '14',
+ 'id' => '2',
'1' => 'value 2',
+ 'entity_table' => 'Contact',
'2' => 'value 3',
),
'3' => array(
- 'entity_table' => 'Contact',
- ),
- '4' => array(
'entity_id' => '1',
'latest' => '',
- 'id' => '15',
+ 'id' => '3',
'1' => 'warm beer',
'2' => '',
),
- '5' => array(
+ '4' => array(
'entity_id' => '1',
'latest' => '',
- 'id' => '16',
+ 'id' => '4',
'1' => '',
'2' => '',
),
- '6' => array(
- 'entity_table' => 'Contact',
- ),
- '7' => array(
+ '5' => array(
'entity_id' => '1',
'latest' => '',
- 'id' => '17',
+ 'id' => '5',
'1' => '',
),
- '8' => array(
+ '6' => array(
'entity_id' => '1',
'latest' => 'vegemite',
- 'id' => '18',
+ 'id' => '6',
'1' => 'vegemite',
),
- '9' => array(
+ '7' => array(
'entity_id' => '1',
'latest' => '',
- 'id' => '19',
+ 'id' => '7',
'1' => '',
),
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- /*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).
+/**
+ * Test Generated example of using 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). *
*/
function contact_create_example(){
$params = array(
- 'version' => 3,
'display_name' => 'batman',
'contact_type' => 'Individual',
'api.tag.create' => array(
),
);
- $result = civicrm_api( 'contact','create',$params );
+try{
+ $result = civicrm_api3('contact', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_create_expectedresult(){
'first_name' => '',
'middle_name' => '',
'last_name' => '',
- 'prefix_id' => '',
- 'suffix_id' => '',
'email_greeting_id' => '1',
'email_greeting_custom' => '',
'email_greeting_display' => '',
'organization_name' => '',
'sic_code' => '',
'user_unique_id' => '',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'modified_date' => '2012-11-14 16:02:35',
'api.tag.create' => 6,
'api.entity_tag.create' => array(
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- test demonstrates the syntax to create 2 chained entities
+/**
+ * Test Generated example of using contact create API
+ * test demonstrates the syntax to create 2 chained entities *
*/
function contact_create_example(){
$params = array(
'last_name' => 'xyz3',
'contact_type' => 'Individual',
'email' => 'man3@yahoo.com',
- 'version' => 3,
'api.contribution.create' => array(
'receive_date' => '2010-01-01',
'total_amount' => '100',
),
);
- $result = civicrm_api( 'contact','create',$params );
+try{
+ $result = civicrm_api3('contact', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_create_expectedresult(){
'first_name' => 'abc3',
'middle_name' => '',
'last_name' => 'xyz3',
- 'prefix_id' => '',
- 'suffix_id' => '',
'email_greeting_id' => '1',
'email_greeting_custom' => '',
'email_greeting_display' => '',
'organization_name' => '',
'sic_code' => '',
'user_unique_id' => '',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'modified_date' => '2012-11-14 16:02:35',
'api.contribution.create' => array(
'is_error' => 0,
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- demonstrates creating two websites as an array
+/**
+ * Test Generated example of using contact create API
+ * demonstrates creating two websites as an array *
*/
function contact_create_example(){
$params = array(
'last_name' => 'xyz3',
'contact_type' => 'Individual',
'email' => 'man3@yahoo.com',
- 'version' => 3,
'api.contribution.create' => array(
'receive_date' => '2010-01-01',
'total_amount' => '100',
),
);
- $result = civicrm_api( 'contact','create',$params );
+try{
+ $result = civicrm_api3('contact', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_create_expectedresult(){
'first_name' => 'abc3',
'middle_name' => '',
'last_name' => 'xyz3',
- 'prefix_id' => '',
- 'suffix_id' => '',
'email_greeting_id' => '1',
'email_greeting_custom' => '',
'email_greeting_display' => '',
'organization_name' => '',
'sic_code' => '',
'user_unique_id' => '',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'modified_date' => '2012-11-14 16:02:35',
'api.contribution.create' => array(
'is_error' => 0,
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- /*this demonstrates setting a custom field through the API
+/**
+ * Test Generated example of using contact create API
+ * /*this demonstrates setting a custom field through the API *
*/
function contact_create_example(){
$params = array(
'first_name' => 'abc1',
'contact_type' => 'Individual',
'last_name' => 'xyz1',
- 'version' => 3,
'custom_1' => 'custom string',
+ 'version' => 3,
);
- $result = civicrm_api( 'contact','create',$params );
+try{
+ $result = civicrm_api3('contact', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_create_expectedresult(){
'first_name' => 'abc1',
'middle_name' => '',
'last_name' => 'xyz1',
- 'prefix_id' => '',
- 'suffix_id' => '',
'email_greeting_id' => '1',
'email_greeting_custom' => '',
'email_greeting_display' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- /*this demonstrates setting a custom field through the API
+/**
+ * Test Generated example of using contact get API
+ * /*this demonstrates setting a custom field through the API *
*/
function contact_get_example(){
$params = array(
- 'first_name' => 'abc1',
- 'contact_type' => 'Individual',
- 'last_name' => 'xyz1',
- 'version' => 3,
- 'custom_3' => 'custom string',
+ 'return.custom_1' => 1,
+ 'id' => 1,
);
- $result = civicrm_api( 'contact','get',$params );
+try{
+ $result = civicrm_api3('contact', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_get_expectedresult(){
'values' => array(
'1' => array(
'contact_id' => '1',
- 'civicrm_value_testgetwithcu_3_id' => '1',
- 'custom_3' => 'custom string',
+ 'civicrm_value_testgetwithcu_1_id' => '1',
+ 'custom_1' => 'custom string',
'id' => '1',
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- /*this demonstrates setting a custom field through the API
+/**
+ * Test Generated example of using contact get API
+ * /*this demonstrates setting a custom field through the API *
*/
function contact_get_example(){
$params = array(
- 'return' => 'custom_4',
- 'version' => 3,
+ 'return' => 'custom_1',
'id' => 1,
);
- $result = civicrm_api( 'contact','get',$params );
+try{
+ $result = civicrm_api3('contact', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_get_expectedresult(){
'values' => array(
'1' => array(
'contact_id' => '1',
- 'civicrm_value_testgetwithcu_4_id' => '1',
- 'custom_4' => 'custom string',
+ 'civicrm_value_testgetwithcu_1_id' => '1',
+ 'custom_1' => 'custom string',
'id' => '1',
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- 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
+/**
+ * Test Generated example of using 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 *
*/
function contact_create_example(){
$params = array(
- 'version' => 3,
'id' => 500,
'format.is_success' => 1,
);
- $result = civicrm_api( 'contact','create',$params );
+try{
+ $result = civicrm_api3('contact', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_create_expectedresult(){
$expectedResult = 0;
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- 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
+/**
+ * Test Generated example of using 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 *
*/
function contact_get_example(){
$params = array(
- 'version' => 3,
'id' => 17,
'format.is_success' => 1,
);
- $result = civicrm_api( 'contact','get',$params );
+try{
+ $result = civicrm_api3('contact', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_get_expectedresult(){
$expectedResult = 1;
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- This demonstrates use of the 'format.id_only' param.
+/**
+ * Test Generated example of using 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.
- /* it will be ignored if there is not exactly 1 result
+ /* it will be ignored if there is not exactly 1 result *
*/
function contact_get_example(){
$params = array(
- 'version' => 3,
'id' => 17,
'format.only_id' => 1,
);
- $result = civicrm_api( 'contact','get',$params );
+try{
+ $result = civicrm_api3('contact', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_get_expectedresult(){
$expectedResult = 17;
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- This demonstrates use of the 'format.single_value' param.
+/**
+ * Test Generated example of using 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.
- /* it will be ignored if there is not exactly 1 result
+ /* it will be ignored if there is not exactly 1 result *
*/
function contact_getvalue_example(){
$params = array(
- 'version' => 3,
'id' => 17,
'return' => 'display_name',
);
- $result = civicrm_api( 'contact','getvalue',$params );
+try{
+ $result = civicrm_api3('contact', 'getvalue', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_getvalue_expectedresult(){
$expectedResult = 'Test Contact';
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- /*This demonstrates use of the 'getCount' action
- /* This param causes the count of the only function to be returned as an integer
+/**
+ * Test Generated example of using contact get API
+ * /*This demonstrates use of the 'getCount' action
+ /* This param causes the count of the only function to be returned as an integer *
*/
function contact_get_example(){
$params = array(
- 'version' => 3,
'id' => 17,
);
- $result = civicrm_api( 'contact','get',$params );
+try{
+ $result = civicrm_api3('contact', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_get_expectedresult(){
- $expectedResult = '1';
+ $expectedResult = 1;
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Demonstrate retrieving metadata with custom field options
+/**
+ * Test Generated example of using contact GetFields API
+ * Demonstrate retrieving metadata with custom field options *
*/
function contact_getfields_example(){
$params = array(
'options' => array(
'get_options' => 'custom_1',
),
- 'version' => 3,
'action' => 'create',
);
- $result = civicrm_api( 'contact','GetFields',$params );
+try{
+ $result = civicrm_api3('contact', 'GetFields', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_getfields_expectedresult(){
'dataPattern' => '/^\w+(\s\w+)?+$/',
'export' => true,
),
- 'prefix_id' => array(
- 'name' => 'prefix_id',
- 'type' => 1,
- 'title' => 'Individual Prefix',
- 'import' => true,
- 'where' => 'civicrm_contact.prefix_id',
- 'headerPattern' => '/^(prefix|title)/i',
- 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\.?$/i',
- 'export' => true,
- 'pseudoconstant' => array(
- 'optionGroupName' => 'individual_prefix',
- ),
- ),
- 'suffix_id' => array(
- 'name' => 'suffix_id',
- 'type' => 1,
- 'title' => 'Individual Suffix',
- 'import' => true,
- 'where' => 'civicrm_contact.suffix_id',
- 'headerPattern' => '/^suffix$/i',
- 'dataPattern' => '/^(sr|jr)\.?|i{2,}$/',
- 'export' => true,
- 'pseudoconstant' => array(
- 'optionGroupName' => 'individual_suffix',
- ),
- ),
'email_greeting_id' => array(
'name' => 'email_greeting_id',
'type' => 1,
'export' => true,
'uniqueName' => 'contact_source',
),
+ 'prefix_id' => array(
+ 'name' => 'prefix_id',
+ 'type' => 1,
+ 'title' => 'Individual Prefix',
+ 'import' => true,
+ 'where' => 'civicrm_contact.prefix_id',
+ 'headerPattern' => '/^(prefix|title)/i',
+ 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\.?$/i',
+ 'export' => true,
+ 'pseudoconstant' => array(
+ 'optionGroupName' => 'individual_prefix',
+ ),
+ 'uniqueName' => 'individual_prefix_id',
+ ),
+ 'suffix_id' => array(
+ 'name' => 'suffix_id',
+ 'type' => 1,
+ 'title' => 'Individual Suffix',
+ 'import' => true,
+ 'where' => 'civicrm_contact.suffix_id',
+ 'headerPattern' => '/^suffix$/i',
+ 'dataPattern' => '/^(sr|jr)\.?|i{2,}$/',
+ 'export' => true,
+ 'pseudoconstant' => array(
+ 'optionGroupName' => 'individual_suffix',
+ ),
+ 'uniqueName' => 'individual_suffix_id',
+ ),
'employer_id' => array(
'name' => 'employer_id',
'type' => 1,
'extends_entity_column_id' => '',
'is_view' => 0,
'is_multiple' => 0,
- 'option_group_id' => '97',
+ 'option_group_id' => '99',
'date_format' => '',
'time_format' => '',
'name' => 'custom_1',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- This demonstrates use of the 'format.single_entity_array' param.
+/**
+ * Test Generated example of using 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.
- /* it will be ignored if there is not exactly 1 result
+ /* it will be ignored if there is not exactly 1 result *
*/
function contact_getsingle_example(){
$params = array(
- 'version' => 3,
'id' => 17,
);
- $result = civicrm_api( 'contact','getsingle',$params );
+try{
+ $result = civicrm_api3('contact', 'getsingle', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_getsingle_expectedresult(){
'id' => '17',
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Get all from group and display contacts
+/**
+ * Test Generated example of using contact get API
+ * Get all from group and display contacts *
*/
function contact_get_example(){
$params = array(
'0' => 1,
'1' => 26,
),
- 'version' => 3,
'contact_type' => 'Individual',
);
- $result = civicrm_api( 'contact','get',$params );
+try{
+ $result = civicrm_api3('contact', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-
-/*
-
+/**
+ * Test Generated example of using contact create API
+ * /*this demonstrates setting a custom field through the API *
*/
-function contact_create_example() {
- $params = array(
- 'first_name' => 'abc3',
- 'last_name' => 'xyz3',
- 'contact_type' => 'Individual',
- 'email' => 'man3@yahoo.com',
- 'version' => 3,
- 'api.contribution.create' => array(
- 'receive_date' => '2010-01-01',
- 'total_amount' => '100',
- 'financial_type_id' => 1,
- 'payment_instrument_id' => 1,
- 'non_deductible_amount' => '10',
- 'fee_amount' => '50',
- 'net_amount' => '90',
- 'trxn_id' => 12345,
- 'invoice_id' => 67890,
- 'source' => 'SSF',
- 'contribution_status_id' => 1,
- ),
- 'api.website.create' => array(
- '0' => array(
- 'url' => 'http://civicrm.org',
- ),
- '1' => array(
- 'url' => 'http://chained.org',
- 'website_type_id' => 2,
- ),
- ),
- );
+function contact_create_example(){
+$params = array(
+ 'first_name' => 'abc1',
+ 'contact_type' => 'Individual',
+ 'last_name' => 'xyz1',
+ 'custom_1' => 'custom string',
+);
- require_once 'api/api.php';
- $result = civicrm_api('contact', 'create', $params);
+try{
+ $result = civicrm_api3('contact', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
-function contact_create_expectedresult() {
+function contact_create_expectedresult(){
$expectedResult = array(
- 'is_error' => 0,
- 'version' => 3,
- 'count' => 1,
- 'id' => 1,
- 'values' => array(
+ 'is_error' => 0,
+ 'version' => 3,
+ 'count' => 1,
+ 'id' => 1,
+ 'values' => array(
'1' => array(
- 'id' => 1,
- 'contact_type' => 'Individual',
- 'contact_sub_type' => 'null',
- 'do_not_email' => '',
- 'do_not_phone' => '',
- 'do_not_mail' => '',
- 'do_not_sms' => '',
- 'do_not_trade' => '',
- 'is_opt_out' => '',
- 'legal_identifier' => '',
- 'external_identifier' => '',
- 'sort_name' => 'xyz3, abc3',
- 'display_name' => 'abc3 xyz3',
- 'nick_name' => '',
- 'legal_name' => '',
- 'image_URL' => '',
- 'preferred_communication_method' => '',
- 'preferred_language' => 'en_US',
- 'preferred_mail_format' => '',
- 'api_key' => '',
- 'first_name' => 'abc3',
- 'middle_name' => '',
- 'last_name' => 'xyz3',
- 'prefix_id' => '',
- 'suffix_id' => '',
- 'email_greeting_id' => '',
- 'email_greeting_custom' => '',
- 'email_greeting_display' => '',
- 'postal_greeting_id' => '',
- 'postal_greeting_custom' => '',
- 'postal_greeting_display' => '',
- 'addressee_id' => '',
- 'addressee_custom' => '',
- 'addressee_display' => '',
- 'job_title' => '',
- 'gender_id' => '',
- 'birth_date' => '',
- 'is_deceased' => '',
- 'deceased_date' => '',
- 'household_name' => '',
- 'primary_contact_id' => '',
- 'organization_name' => '',
- 'sic_code' => '',
- 'user_unique_id' => '',
- 'api.contribution.create' => array(
- 'is_error' => 0,
- 'version' => 3,
- 'count' => 1,
- 'id' => 2,
- 'values' => array(
- '0' => array(
- 'id' => 2,
- 'contact_id' => 1,
- 'financial_type_id' => 1,
- 'contribution_page_id' => '',
- 'payment_instrument_id' => 1,
- 'receive_date' => '20100101000000',
- 'non_deductible_amount' => '10',
- 'total_amount' => '100',
- 'fee_amount' => '50',
- 'net_amount' => '90',
- 'trxn_id' => 12345,
- 'invoice_id' => 67890,
- 'currency' => 'USD',
- 'cancel_date' => '',
- 'cancel_reason' => '',
- 'receipt_date' => '',
- 'thankyou_date' => '',
- 'source' => 'SSF',
- 'amount_level' => '',
- 'contribution_recur_id' => '',
- 'honor_contact_id' => '',
- 'is_test' => '',
- 'is_pay_later' => '',
- 'contribution_status_id' => 1,
- 'honor_type_id' => '',
- 'address_id' => '',
- 'check_number' => 'null',
- 'campaign_id' => '',
- ),
- ),
- ),
- 'api.website.create' => array(
- '0' => array(
- 'is_error' => 0,
- 'version' => 3,
- 'count' => 1,
- 'id' => 3,
- 'values' => array(
- '0' => array(
- 'id' => 3,
- 'contact_id' => 1,
- 'url' => 'http://civicrm.org',
- 'website_type_id' => '',
- ),
- ),
- ),
- '1' => array(
- 'is_error' => 0,
- 'version' => 3,
- 'count' => 1,
- 'id' => 4,
- 'values' => array(
- '0' => array(
- 'id' => 4,
- 'contact_id' => 1,
- 'url' => 'http://chained.org',
- 'website_type_id' => 2,
- ),
- ),
- ),
+ 'id' => '1',
+ 'contact_type' => 'Individual',
+ 'contact_sub_type' => '',
+ 'do_not_email' => 0,
+ 'do_not_phone' => 0,
+ 'do_not_mail' => 0,
+ 'do_not_sms' => 0,
+ 'do_not_trade' => 0,
+ 'is_opt_out' => 0,
+ 'legal_identifier' => '',
+ 'external_identifier' => '',
+ 'sort_name' => 'xyz1, abc1',
+ 'display_name' => 'abc1 xyz1',
+ 'nick_name' => '',
+ 'legal_name' => '',
+ 'image_URL' => '',
+ 'preferred_communication_method' => '',
+ 'preferred_language' => 'en_US',
+ 'preferred_mail_format' => 'Both',
+ 'hash' => '67eac7789eaee00',
+ 'api_key' => '',
+ 'first_name' => 'abc1',
+ 'middle_name' => '',
+ 'last_name' => 'xyz1',
+ 'email_greeting_id' => '1',
+ 'email_greeting_custom' => '',
+ 'email_greeting_display' => '',
+ 'postal_greeting_id' => '1',
+ 'postal_greeting_custom' => '',
+ 'postal_greeting_display' => '',
+ 'addressee_id' => '1',
+ 'addressee_custom' => '',
+ 'addressee_display' => '',
+ 'job_title' => '',
+ 'gender_id' => '',
+ 'birth_date' => '',
+ 'is_deceased' => 0,
+ 'deceased_date' => '',
+ 'household_name' => '',
+ 'primary_contact_id' => '',
+ 'organization_name' => '',
+ 'sic_code' => '',
+ 'user_unique_id' => '',
+ 'created_date' => '2013-07-28 05:52:14',
+ 'modified_date' => '2012-11-14 16:02:35',
),
- ),
),
- );
+);
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
-* http://svn.civicrm.org/civicrm/branches/v3.4/tests/phpunit/CiviTest/api/v3/ContactTest.php
+* testCreateWithCustom and can be found in
+* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContactTest.php
*
* You can see the outcome of the API tests at
* http://tests.dev.civicrm.org/trunk/results-api_v3
+*
+* To Learn about the API read
+* http://book.civicrm.org/developer/current/techniques/api/
+*
* and review the wiki at
* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
+*
* 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
+*/
\ No newline at end of file
<?php
-
-/*
-
+/**
+ * Test Generated example of using contact delete API
+ * *
*/
function contact_delete_example(){
$params = array(
- 'id' => 17,
- 'version' => 3,
+ 'id' => 1,
);
- $result = civicrm_api( 'contact','delete',$params );
+try{
+ $result = civicrm_api3('contact', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_delete_expectedresult(){
'values' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using contact get API
+ * *
*/
function contact_get_example(){
$params = array(
'email' => 'man2@yahoo.com',
- 'version' => 3,
);
- $result = civicrm_api( 'contact','get',$params );
+try{
+ $result = civicrm_api3('contact', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Demonstrates retrieving options for a custom field
+/**
+ * Test Generated example of using contact getoptions API
+ * Demonstrates retrieving options for a custom field *
*/
function contact_getoptions_example(){
$params = array(
'field' => 'custom_1',
- 'version' => 3,
);
- $result = civicrm_api( 'contact','getoptions',$params );
+try{
+ $result = civicrm_api3('contact', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contact_getoptions_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Demonstrates creating contribution with Note Entity
+/**
+ * Test Generated example of using contribution create API
+ * Demonstrates creating contribution with Note Entity *
*/
function contribution_create_example(){
$params = array(
'invoice_id' => 67890,
'source' => 'SSF',
'contribution_status_id' => 1,
- 'version' => 3,
'note' => 'my contribution note',
);
- $result = civicrm_api( 'contribution','create',$params );
+try{
+ $result = civicrm_api3('contribution', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contribution_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Demonstrates creating contribution with SoftCredit
+/**
+ * Test Generated example of using contribution create API
+ * Demonstrates creating contribution with SoftCredit *
*/
function contribution_create_example(){
$params = array(
'net_amount' => '95',
'source' => 'SSF',
'contribution_status_id' => 1,
- 'version' => 3,
'soft_credit_to' => 2,
);
- $result = civicrm_api( 'contribution','create',$params );
+try{
+ $result = civicrm_api3('contribution', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contribution_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Create Contribution with Nested Line Items
+/**
+ * Test Generated example of using contribution create API
+ * Create Contribution with Nested Line Items *
*/
function contribution_create_example(){
$params = array(
'invoice_id' => 67890,
'source' => 'SSF',
'contribution_status_id' => 1,
- 'version' => 3,
'skipLineItem' => 1,
'api.line_item.create' => array(
'0' => array(
'unit_price' => '80',
),
),
- 'debug' => 0,
);
- $result = civicrm_api( 'contribution','create',$params );
+try{
+ $result = civicrm_api3('contribution', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contribution_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using contribution create API
+ * *
*/
function contribution_create_example(){
$params = array(
'invoice_id' => 67890,
'source' => 'SSF',
'contribution_status_id' => 2,
- 'version' => 3,
);
- $result = civicrm_api( 'contribution','create',$params );
+try{
+ $result = civicrm_api3('contribution', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contribution_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using contribution delete API
+ * *
*/
function contribution_delete_example(){
$params = array(
'id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'contribution','delete',$params );
+try{
+ $result = civicrm_api3('contribution', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contribution_delete_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using contribution get API
+ * *
*/
function contribution_get_example(){
$params = array(
'contribution_id' => 1,
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'contribution','get',$params );
+try{
+ $result = civicrm_api3('contribution', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contribution_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using contribution_page create API
+ * *
*/
function contribution_page_create_example(){
$params = array(
- 'version' => 3,
'title' => 'Test Contribution Page',
'financial_type_id' => 1,
'currency' => 'NZD',
'goal_amount' => 34567,
);
- $result = civicrm_api( 'contribution_page','create',$params );
+try{
+ $result = civicrm_api3('contribution_page', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contribution_page_create_expectedresult(){
'start_date' => '',
'end_date' => '',
'created_id' => '',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'currency' => 'NZD',
'campaign_id' => '',
'is_share' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using contribution_page delete API
+ * *
*/
function contribution_page_delete_example(){
$params = array(
- 'version' => 3,
'id' => 4,
);
- $result = civicrm_api( 'contribution_page','delete',$params );
+try{
+ $result = civicrm_api3('contribution_page', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contribution_page_delete_expectedresult(){
'values' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using contribution_page get API
+ * *
*/
function contribution_page_get_example(){
$params = array(
- 'version' => 3,
'amount' => '34567',
'currency' => 'NZD',
'financial_type_id' => 1,
);
- $result = civicrm_api( 'contribution_page','get',$params );
+try{
+ $result = civicrm_api3('contribution_page', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contribution_page_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using contribution_recur create API
+ * *
*/
function contribution_recur_create_example(){
$params = array(
- 'version' => 3,
'contact_id' => 3,
'installments' => '12',
'frequency_interval' => '1',
'frequency_unit' => 'day',
);
- $result = civicrm_api( 'contribution_recur','create',$params );
+try{
+ $result = civicrm_api3('contribution_recur', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contribution_recur_create_expectedresult(){
'frequency_interval' => '1',
'installments' => '12',
'start_date' => '20120101000000',
- 'create_date' => '20130713234826',
+ 'create_date' => '20120130621222105',
'modified_date' => '2012-11-14 16:02:35',
'cancel_date' => '',
'end_date' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using contribution_recur delete API
+ * *
*/
function contribution_recur_delete_example(){
$params = array(
- 'version' => 3,
'id' => 1,
);
- $result = civicrm_api( 'contribution_recur','delete',$params );
+try{
+ $result = civicrm_api3('contribution_recur', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contribution_recur_delete_expectedresult(){
'values' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using contribution_recur get API
+ * *
*/
function contribution_recur_get_example(){
$params = array(
- 'version' => 3,
'amount' => '500',
);
- $result = civicrm_api( 'contribution_recur','get',$params );
+try{
+ $result = civicrm_api3('contribution_recur', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contribution_recur_get_expectedresult(){
'frequency_interval' => '1',
'installments' => '12',
'start_date' => '2012-01-01 00:00:00',
- 'create_date' => '2013-07-13 23:48:27',
+ 'create_date' => '20120130621222105',
'contribution_status_id' => '1',
'is_test' => 0,
'cycle_day' => '1',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using contribution_soft create API
+ * *
*/
function contribution_soft_create_example(){
$params = array(
'contact_id' => 2,
'amount' => '10',
'currency' => 'USD',
- 'version' => 3,
);
- $result = civicrm_api( 'contribution_soft','create',$params );
+try{
+ $result = civicrm_api3('contribution_soft', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contribution_soft_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using contribution_soft delete API
+ * *
*/
function contribution_soft_delete_example(){
$params = array(
'id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'contribution_soft','delete',$params );
+try{
+ $result = civicrm_api3('contribution_soft', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contribution_soft_delete_expectedresult(){
$expectedResult = '';
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using contribution_soft get API
+ * *
*/
function contribution_soft_get_example(){
$params = array(
'id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'contribution_soft','get',$params );
+try{
+ $result = civicrm_api3('contribution_soft', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function contribution_soft_get_expectedresult(){
'1' => array(
'id' => '1',
'contribution_id' => '1',
- 'contact_id' => '2',
+ 'contact_id' => '4',
'amount' => '10.00',
'currency' => 'USD',
'pcp_display_in_roll' => 0,
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-
-
-/*
-
+/**
+ * Test Generated example of using custom_field create API
+ * *
*/
-function custom_field_create_example() {
- $params = array(
- 'custom_group_id' => 1,
- 'name' => 'test_date',
- 'label' => 'test_date',
- 'html_type' => 'Select Date',
- 'data_type' => 'Date',
- 'default_value' => '20071212',
- 'weight' => 4,
- 'is_required' => 1,
- 'is_searchable' => 0,
- 'is_active' => 1,
- 'version' => 3,
- );
+function custom_field_create_example(){
+$params = array(
+ 'custom_group_id' => 1,
+ 'name' => 'test_textfield2',
+ 'label' => 'Name1',
+ 'html_type' => 'Text',
+ 'data_type' => 'String',
+ 'default_value' => 'abc',
+ 'weight' => 4,
+ 'is_required' => 1,
+ 'is_searchable' => 0,
+ 'is_active' => 1,
+);
- require_once 'api/api.php';
- $result = civicrm_api('custom_field', 'create', $params);
+try{
+ $result = civicrm_api3('custom_field', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
-function custom_field_create_expectedresult() {
+function custom_field_create_expectedresult(){
$expectedResult = array(
- 'is_error' => 0,
- 'version' => 3,
- 'count' => 1,
- 'id' => 1,
- 'values' => array(
+ 'is_error' => 0,
+ 'version' => 3,
+ 'count' => 1,
+ 'id' => 1,
+ 'values' => array(
'1' => array(
- 'id' => '1',
- 'custom_group_id' => '1',
- 'name' => 'test_date',
- 'label' => 'test_date',
- 'data_type' => 'Date',
- 'html_type' => 'Select Date',
- 'default_value' => '20071212',
- 'is_required' => '1',
- 'is_searchable' => 0,
- 'is_search_range' => 0,
- 'weight' => '4',
- 'help_pre' => '',
- 'help_post' => '',
- 'mask' => '',
- 'attributes' => '',
- 'javascript' => '',
- 'is_active' => '1',
- 'is_view' => 0,
- 'options_per_line' => '',
- 'text_length' => '',
- 'start_date_years' => '',
- 'end_date_years' => '',
- 'date_format' => '',
- 'time_format' => '',
- 'note_columns' => '',
- 'note_rows' => '',
- 'column_name' => 'test_date_1',
- 'option_group_id' => '',
- ),
+ 'id' => '1',
+ 'custom_group_id' => '1',
+ 'name' => 'Name1',
+ 'label' => 'Name1',
+ 'data_type' => 'String',
+ 'html_type' => 'Text',
+ 'default_value' => 'abc',
+ 'is_required' => '1',
+ 'is_searchable' => 0,
+ 'is_search_range' => 0,
+ 'weight' => '4',
+ 'help_pre' => '',
+ 'help_post' => '',
+ 'mask' => '',
+ 'attributes' => '',
+ 'javascript' => '',
+ 'is_active' => '1',
+ 'is_view' => 0,
+ 'options_per_line' => '',
+ 'text_length' => '',
+ 'start_date_years' => '',
+ 'end_date_years' => '',
+ 'date_format' => '',
+ 'time_format' => '',
+ 'note_columns' => '',
+ 'note_rows' => '',
+ 'column_name' => 'name1_1',
+ 'option_group_id' => '',
+ 'filter' => '',
+ ),
),
- );
+);
return $expectedResult;
}
-
-
/*
* This example has been generated from the API test suite. The test that created it is called
-* custom_field_create
+*
+* testCustomFieldCreateWithEdit and can be found in
+* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/CustomFieldTest.php
+*
* You can see the outcome of the API tests at
* http://tests.dev.civicrm.org/trunk/results-api_v3
+*
+* To Learn about the API read
+* http://book.civicrm.org/developer/current/techniques/api/
+*
* and review the wiki at
-* http://wiki.civicrm.org/confluence/display/CRMDOC40/CiviCRM+Public+APIs
+* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
+*
* 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
+*/
\ No newline at end of file
<?php
-
-/*
-
+/**
+ * Test Generated example of using custom_field delete API
+ * *
*/
function custom_field_delete_example(){
$params = array(
- 'version' => 3,
'id' => 1,
);
- $result = civicrm_api( 'custom_field','delete',$params );
+try{
+ $result = civicrm_api3('custom_field', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function custom_field_delete_expectedresult(){
'values' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using custom_group create API
+ * *
*/
function custom_group_create_example(){
$params = array(
'help_pre' => 'This is Pre Help For Test Group 1',
'help_post' => 'This is Post Help For Test Group 1',
'is_active' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'custom_group','create',$params );
+try{
+ $result = civicrm_api3('custom_group', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function custom_group_create_expectedresult(){
'max_multiple' => 'null',
'collapse_adv_display' => '',
'created_id' => '',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'is_reserved' => '',
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using custom_group delete API
+ * *
*/
function custom_group_delete_example(){
$params = array(
'id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'custom_group','delete',$params );
+try{
+ $result = civicrm_api3('custom_group', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function custom_group_delete_expectedresult(){
'values' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using custom_group get API
+ * *
*/
function custom_group_get_example(){
-$params = array(
- 'version' => 3,
-);
+$params = array();
- $result = civicrm_api( 'custom_group','get',$params );
+try{
+ $result = civicrm_api3('custom_group', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function custom_group_get_expectedresult(){
'table_name' => 'civicrm_value_test_group_1_1',
'is_multiple' => 0,
'collapse_adv_display' => 0,
+ 'is_reserved' => 0,
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- utilises field names
+/**
+ * Test Generated example of using custom_value get API
+ * utilises field names *
*/
function custom_value_get_example(){
$params = array(
'id' => 2,
- 'version' => 3,
'entity_id' => 2,
'format.field_names' => 1,
);
- $result = civicrm_api( 'custom_value','get',$params );
+try{
+ $result = civicrm_api3('custom_value', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function custom_value_get_expectedresult(){
'entity_id' => '2',
'latest' => 'value 1',
'id' => 'mySingleField',
- '0' => 'value 1',
),
'Cust_Field' => array(
'entity_id' => '2',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using custom_value create API
+ * *
*/
function custom_value_create_example(){
-$params = array(
+$params = array(
'custom_1' => 'customString',
- 'version' => 3,
'entity_id' => 3,
);
- $result = civicrm_api( 'custom_value','create',$params );
+try{
+ $result = civicrm_api3('custom_value', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function custom_value_create_expectedresult(){
- $expectedResult = array(
+ $expectedResult = array(
'is_error' => 0,
'version' => 3,
'count' => 1,
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- /*this demonstrates the use of CustomValue get
+/**
+ * Test Generated example of using custom_value get API
+ * /*this demonstrates the use of CustomValue get *
*/
function custom_value_get_example(){
$params = array(
'id' => 2,
- 'version' => 3,
'entity_id' => 2,
);
- $result = civicrm_api( 'custom_value','get',$params );
+try{
+ $result = civicrm_api3('custom_value', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function custom_value_get_expectedresult(){
'entity_id' => '2',
'latest' => 'value 1',
'id' => '1',
- '0' => 'value 1',
),
'2' => array(
'entity_id' => '2',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using domain create API
+ * *
*/
function domain_create_example(){
$params = array(
'name' => 'A-team domain',
'description' => 'domain of chaos',
- 'version' => 3,
'domain_version' => '4.2',
'contact_id' => 6,
);
- $result = civicrm_api( 'domain','create',$params );
+try{
+ $result = civicrm_api3('domain', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function domain_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using domain get API
+ * *
*/
function domain_get_example(){
$params = array(
- 'version' => 3,
'sequential' => 1,
);
- $result = civicrm_api( 'domain','get',$params );
+try{
+ $result = civicrm_api3('domain', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function domain_get_expectedresult(){
'0' => array(
'id' => '1',
'name' => 'Default Domain Name',
- 'config_backend' => 'a:79:{s:10:"userSystem";O:26:"CRM_Utils_System_UnitTests":4:{s:9:"is_drupal";b:0;s:9:"is_joomla";b:0;s:12:"is_wordpress";b:0;s:24:"supports_form_extensions";b:0;}s:11:"initialized";i:0;s:15:"DAOFactoryClass";s:23:"CRM_Contact_DAO_Factory";s:17:"componentRegistry";O:18:"CRM_Core_Component":0:{}s:9:"inCiviCRM";b:0;s:18:"recaptchaPublicKey";N;s:5:"debug";i:0;s:9:"backtrace";i:0;s:12:"resourceBase";N;s:13:"extensionsURL";N;s:12:"countryLimit";a:1:{i:0;s:4:"1228";}s:27:"defaultContactStateProvince";N;s:13:"provinceLimit";a:1:{i:0;s:4:"1228";}s:21:"defaultContactCountry";s:4:"1228";s:15:"defaultCurrency";s:3:"USD";s:10:"lcMessages";s:5:"en_US";s:18:"dateformatDatetime";s:20:"%B %E%f, %Y %l:%M %P";s:14:"dateformatFull";s:11:"%B %E%f, %Y";s:17:"dateformatPartial";s:5:"%B %Y";s:14:"dateformatYear";s:2:"%Y";s:14:"dateformatTime";s:8:"%l:%M %P";s:15:"timeInputFormat";i:1;s:15:"dateInputFormat";s:8:"mm/dd/yy";s:15:"fiscalYearStart";a:2:{s:1:"M";i:1;s:1:"d";i:1;}s:11:"moneyformat";s:5:"%c %a";s:16:"moneyvalueformat";s:3:"%!i";s:15:"currencySymbols";s:0:"";s:21:"defaultCurrencySymbol";s:1:"$";s:20:"monetaryDecimalPoint";s:1:".";s:25:"monetaryThousandSeparator";s:1:",";s:14:"gettextCodeset";s:5:"utf-8";s:13:"gettextDomain";s:7:"civicrm";s:27:"userFrameworkUsersTableName";s:5:"users";s:21:"userFrameworkFrontend";b:0;s:20:"userFrameworkLogging";b:0;s:17:"maxImportFileSize";i:1048576;s:11:"maxFileSize";i:2;s:11:"mapProvider";N;s:9:"mapAPIKey";N;s:11:"geoProvider";N;s:9:"geoAPIKey";N;s:13:"geocodeMethod";s:0:"";s:12:"mapGeoCoding";i:1;s:7:"logging";b:0;s:12:"versionCheck";b:1;s:16:"enableComponents";a:6:{i:0;s:14:"CiviContribute";i:1;s:10:"CiviPledge";i:2;s:10:"CiviMember";i:3;s:9:"CiviEvent";i:4;s:8:"CiviMail";i:5;s:10:"CiviReport";}s:18:"enableComponentIDs";a:6:{i:0;i:1;i:1;i:6;i:2;i:2;i:3;i:3;i:4;i:4;i:5;i:8;}s:9:"enableSSL";b:0;s:18:"fatalErrorTemplate";s:20:"CRM/common/fatal.tpl";s:17:"fatalErrorHandler";N;s:14:"legacyEncoding";s:12:"Windows-1252";s:14:"fieldSeparator";s:1:",";s:17:"maxLocationBlocks";i:2;s:15:"captchaFontPath";s:25:"/usr/X11R6/lib/X11/fonts/";s:11:"captchaFont";s:17:"HelveticaBold.ttf";s:21:"includeWildCardInName";i:1;s:18:"includeEmailInName";i:1;s:21:"includeNickNameInName";i:0;s:22:"smartGroupCacheTimeout";i:5;s:22:"defaultSearchProfileID";N;s:21:"dashboardCacheTimeout";i:1440;s:15:"doNotResetCache";i:0;s:24:"includeAlphabeticalPager";i:1;s:20:"includeOrderByClause";i:1;s:13:"oldInputStyle";i:1;s:14:"formKeyDisable";b:0;s:21:"doNotAttachPDFReceipt";b:0;s:15:"wkhtmltopdfPath";b:0;s:10:"wpBasePage";N;s:13:"verpSeparator";s:1:".";s:12:"mailerPeriod";i:180;s:16:"mailerSpoolLimit";i:0;s:16:"mailerBatchLimit";i:0;s:13:"mailerJobSize";i:0;s:13:"mailerJobsMax";i:0;s:16:"mailThrottleTime";i:0;s:12:"customCSSURL";N;s:15:"civiRelativeURL";s:13:"/index.php?q=";s:11:"civiVersion";s:10:"4.4.alpha1";}',
+ 'config_backend' => 'a:80:{s:10:"userSystem";O:26:"CRM_Utils_System_UnitTests":4:{s:9:"is_drupal";b:0;s:9:"is_joomla";b:0;s:12:"is_wordpress";b:0;s:24:"supports_form_extensions";b:0;}s:11:"initialized";i:0;s:15:"DAOFactoryClass";s:23:"CRM_Contact_DAO_Factory";s:17:"componentRegistry";O:18:"CRM_Core_Component":0:{}s:9:"inCiviCRM";b:0;s:18:"recaptchaPublicKey";N;s:5:"debug";i:0;s:9:"backtrace";i:0;s:12:"resourceBase";N;s:13:"extensionsURL";N;s:12:"countryLimit";a:1:{i:0;s:4:"1228";}s:27:"defaultContactStateProvince";N;s:13:"provinceLimit";a:1:{i:0;s:4:"1228";}s:21:"defaultContactCountry";s:4:"1228";s:15:"defaultCurrency";s:3:"USD";s:10:"lcMessages";s:5:"en_US";s:18:"dateformatDatetime";s:20:"%B %E%f, %Y %l:%M %P";s:14:"dateformatFull";s:11:"%B %E%f, %Y";s:17:"dateformatPartial";s:5:"%B %Y";s:14:"dateformatYear";s:2:"%Y";s:14:"dateformatTime";s:8:"%l:%M %P";s:15:"timeInputFormat";i:1;s:15:"dateInputFormat";s:8:"mm/dd/yy";s:15:"fiscalYearStart";a:2:{s:1:"M";i:1;s:1:"d";i:1;}s:11:"moneyformat";s:5:"%c %a";s:16:"moneyvalueformat";s:3:"%!i";s:15:"currencySymbols";s:0:"";s:21:"defaultCurrencySymbol";s:1:"$";s:20:"monetaryDecimalPoint";s:1:".";s:25:"monetaryThousandSeparator";s:1:",";s:14:"gettextCodeset";s:5:"utf-8";s:13:"gettextDomain";s:7:"civicrm";s:27:"userFrameworkUsersTableName";s:5:"users";s:21:"userFrameworkFrontend";b:0;s:20:"userFrameworkLogging";b:0;s:17:"maxImportFileSize";i:1048576;s:11:"maxFileSize";i:2;s:11:"mapProvider";N;s:9:"mapAPIKey";N;s:11:"geoProvider";N;s:9:"geoAPIKey";N;s:13:"geocodeMethod";s:0:"";s:12:"mapGeoCoding";i:1;s:7:"logging";b:0;s:12:"versionCheck";b:1;s:16:"enableComponents";a:6:{i:0;s:14:"CiviContribute";i:1;s:10:"CiviPledge";i:2;s:10:"CiviMember";i:3;s:9:"CiviEvent";i:4;s:8:"CiviMail";i:5;s:10:"CiviReport";}s:18:"enableComponentIDs";a:6:{i:0;i:1;i:1;i:6;i:2;i:2;i:3;i:3;i:4;i:4;i:5;i:8;}s:9:"enableSSL";b:0;s:18:"fatalErrorTemplate";s:20:"CRM/common/fatal.tpl";s:17:"fatalErrorHandler";N;s:14:"legacyEncoding";s:12:"Windows-1252";s:14:"fieldSeparator";s:1:",";s:17:"maxLocationBlocks";i:2;s:15:"captchaFontPath";s:25:"/usr/X11R6/lib/X11/fonts/";s:11:"captchaFont";s:17:"HelveticaBold.ttf";s:21:"includeWildCardInName";i:1;s:18:"includeEmailInName";i:1;s:21:"includeNickNameInName";i:0;s:22:"smartGroupCacheTimeout";i:5;s:22:"defaultSearchProfileID";N;s:21:"dashboardCacheTimeout";i:1440;s:15:"doNotResetCache";i:0;s:24:"includeAlphabeticalPager";i:1;s:20:"includeOrderByClause";i:1;s:13:"oldInputStyle";i:1;s:14:"formKeyDisable";b:0;s:21:"doNotAttachPDFReceipt";b:0;s:15:"wkhtmltopdfPath";b:0;s:23:"secondDegRelPermissions";b:0;s:10:"wpBasePage";N;s:13:"verpSeparator";s:1:".";s:12:"mailerPeriod";i:180;s:16:"mailerSpoolLimit";i:0;s:16:"mailerBatchLimit";i:0;s:13:"mailerJobSize";i:0;s:13:"mailerJobsMax";i:0;s:16:"mailThrottleTime";i:0;s:12:"customCSSURL";N;s:15:"civiRelativeURL";s:13:"/index.php?q=";s:11:"civiVersion";s:10:"4.4.alpha1";}',
'version' => '3',
'contact_id' => '3',
'domain_email' => 'my@email.com',
'1' => array(
'id' => '2',
'name' => 'Second Domain',
- 'config_backend' => 'a:79:{s:10:"userSystem";O:26:"CRM_Utils_System_UnitTests":4:{s:9:"is_drupal";b:0;s:9:"is_joomla";b:0;s:12:"is_wordpress";b:0;s:24:"supports_form_extensions";b:0;}s:11:"initialized";i:0;s:15:"DAOFactoryClass";s:23:"CRM_Contact_DAO_Factory";s:17:"componentRegistry";O:18:"CRM_Core_Component":0:{}s:9:"inCiviCRM";b:0;s:18:"recaptchaPublicKey";N;s:5:"debug";i:0;s:9:"backtrace";i:0;s:12:"resourceBase";N;s:13:"extensionsURL";N;s:12:"countryLimit";a:1:{i:0;s:4:"1228";}s:27:"defaultContactStateProvince";N;s:13:"provinceLimit";a:1:{i:0;s:4:"1228";}s:21:"defaultContactCountry";s:4:"1228";s:15:"defaultCurrency";s:3:"USD";s:10:"lcMessages";s:5:"en_US";s:18:"dateformatDatetime";s:20:"%B %E%f, %Y %l:%M %P";s:14:"dateformatFull";s:11:"%B %E%f, %Y";s:17:"dateformatPartial";s:5:"%B %Y";s:14:"dateformatYear";s:2:"%Y";s:14:"dateformatTime";s:8:"%l:%M %P";s:15:"timeInputFormat";i:1;s:15:"dateInputFormat";s:8:"mm/dd/yy";s:15:"fiscalYearStart";a:2:{s:1:"M";i:1;s:1:"d";i:1;}s:11:"moneyformat";s:5:"%c %a";s:16:"moneyvalueformat";s:3:"%!i";s:15:"currencySymbols";s:0:"";s:21:"defaultCurrencySymbol";s:1:"$";s:20:"monetaryDecimalPoint";s:1:".";s:25:"monetaryThousandSeparator";s:1:",";s:14:"gettextCodeset";s:5:"utf-8";s:13:"gettextDomain";s:7:"civicrm";s:27:"userFrameworkUsersTableName";s:5:"users";s:21:"userFrameworkFrontend";b:0;s:20:"userFrameworkLogging";b:0;s:17:"maxImportFileSize";i:1048576;s:11:"maxFileSize";i:2;s:11:"mapProvider";N;s:9:"mapAPIKey";N;s:11:"geoProvider";N;s:9:"geoAPIKey";N;s:13:"geocodeMethod";s:0:"";s:12:"mapGeoCoding";i:1;s:7:"logging";b:0;s:12:"versionCheck";b:1;s:16:"enableComponents";a:6:{i:0;s:14:"CiviContribute";i:1;s:10:"CiviPledge";i:2;s:10:"CiviMember";i:3;s:9:"CiviEvent";i:4;s:8:"CiviMail";i:5;s:10:"CiviReport";}s:18:"enableComponentIDs";a:6:{i:0;i:1;i:1;i:6;i:2;i:2;i:3;i:3;i:4;i:4;i:5;i:8;}s:9:"enableSSL";b:0;s:18:"fatalErrorTemplate";s:20:"CRM/common/fatal.tpl";s:17:"fatalErrorHandler";N;s:14:"legacyEncoding";s:12:"Windows-1252";s:14:"fieldSeparator";s:1:",";s:17:"maxLocationBlocks";i:2;s:15:"captchaFontPath";s:25:"/usr/X11R6/lib/X11/fonts/";s:11:"captchaFont";s:17:"HelveticaBold.ttf";s:21:"includeWildCardInName";i:1;s:18:"includeEmailInName";i:1;s:21:"includeNickNameInName";i:0;s:22:"smartGroupCacheTimeout";i:5;s:22:"defaultSearchProfileID";N;s:21:"dashboardCacheTimeout";i:1440;s:15:"doNotResetCache";i:0;s:24:"includeAlphabeticalPager";i:1;s:20:"includeOrderByClause";i:1;s:13:"oldInputStyle";i:1;s:14:"formKeyDisable";b:0;s:21:"doNotAttachPDFReceipt";b:0;s:15:"wkhtmltopdfPath";b:0;s:10:"wpBasePage";N;s:13:"verpSeparator";s:1:".";s:12:"mailerPeriod";i:180;s:16:"mailerSpoolLimit";i:0;s:16:"mailerBatchLimit";i:0;s:13:"mailerJobSize";i:0;s:13:"mailerJobsMax";i:0;s:16:"mailThrottleTime";i:0;s:12:"customCSSURL";N;s:15:"civiRelativeURL";s:13:"/index.php?q=";s:11:"civiVersion";s:10:"4.4.alpha1";}',
+ 'config_backend' => 'a:80:{s:10:"userSystem";O:26:"CRM_Utils_System_UnitTests":4:{s:9:"is_drupal";b:0;s:9:"is_joomla";b:0;s:12:"is_wordpress";b:0;s:24:"supports_form_extensions";b:0;}s:11:"initialized";i:0;s:15:"DAOFactoryClass";s:23:"CRM_Contact_DAO_Factory";s:17:"componentRegistry";O:18:"CRM_Core_Component":0:{}s:9:"inCiviCRM";b:0;s:18:"recaptchaPublicKey";N;s:5:"debug";i:0;s:9:"backtrace";i:0;s:12:"resourceBase";N;s:13:"extensionsURL";N;s:12:"countryLimit";a:1:{i:0;s:4:"1228";}s:27:"defaultContactStateProvince";N;s:13:"provinceLimit";a:1:{i:0;s:4:"1228";}s:21:"defaultContactCountry";s:4:"1228";s:15:"defaultCurrency";s:3:"USD";s:10:"lcMessages";s:5:"en_US";s:18:"dateformatDatetime";s:20:"%B %E%f, %Y %l:%M %P";s:14:"dateformatFull";s:11:"%B %E%f, %Y";s:17:"dateformatPartial";s:5:"%B %Y";s:14:"dateformatYear";s:2:"%Y";s:14:"dateformatTime";s:8:"%l:%M %P";s:15:"timeInputFormat";i:1;s:15:"dateInputFormat";s:8:"mm/dd/yy";s:15:"fiscalYearStart";a:2:{s:1:"M";i:1;s:1:"d";i:1;}s:11:"moneyformat";s:5:"%c %a";s:16:"moneyvalueformat";s:3:"%!i";s:15:"currencySymbols";s:0:"";s:21:"defaultCurrencySymbol";s:1:"$";s:20:"monetaryDecimalPoint";s:1:".";s:25:"monetaryThousandSeparator";s:1:",";s:14:"gettextCodeset";s:5:"utf-8";s:13:"gettextDomain";s:7:"civicrm";s:27:"userFrameworkUsersTableName";s:5:"users";s:21:"userFrameworkFrontend";b:0;s:20:"userFrameworkLogging";b:0;s:17:"maxImportFileSize";i:1048576;s:11:"maxFileSize";i:2;s:11:"mapProvider";N;s:9:"mapAPIKey";N;s:11:"geoProvider";N;s:9:"geoAPIKey";N;s:13:"geocodeMethod";s:0:"";s:12:"mapGeoCoding";i:1;s:7:"logging";b:0;s:12:"versionCheck";b:1;s:16:"enableComponents";a:6:{i:0;s:14:"CiviContribute";i:1;s:10:"CiviPledge";i:2;s:10:"CiviMember";i:3;s:9:"CiviEvent";i:4;s:8:"CiviMail";i:5;s:10:"CiviReport";}s:18:"enableComponentIDs";a:6:{i:0;i:1;i:1;i:6;i:2;i:2;i:3;i:3;i:4;i:4;i:5;i:8;}s:9:"enableSSL";b:0;s:18:"fatalErrorTemplate";s:20:"CRM/common/fatal.tpl";s:17:"fatalErrorHandler";N;s:14:"legacyEncoding";s:12:"Windows-1252";s:14:"fieldSeparator";s:1:",";s:17:"maxLocationBlocks";i:2;s:15:"captchaFontPath";s:25:"/usr/X11R6/lib/X11/fonts/";s:11:"captchaFont";s:17:"HelveticaBold.ttf";s:21:"includeWildCardInName";i:1;s:18:"includeEmailInName";i:1;s:21:"includeNickNameInName";i:0;s:22:"smartGroupCacheTimeout";i:5;s:22:"defaultSearchProfileID";N;s:21:"dashboardCacheTimeout";i:1440;s:15:"doNotResetCache";i:0;s:24:"includeAlphabeticalPager";i:1;s:20:"includeOrderByClause";i:1;s:13:"oldInputStyle";i:1;s:14:"formKeyDisable";b:0;s:21:"doNotAttachPDFReceipt";b:0;s:15:"wkhtmltopdfPath";b:0;s:23:"secondDegRelPermissions";b:0;s:10:"wpBasePage";N;s:13:"verpSeparator";s:1:".";s:12:"mailerPeriod";i:180;s:16:"mailerSpoolLimit";i:0;s:16:"mailerBatchLimit";i:0;s:13:"mailerJobSize";i:0;s:13:"mailerJobsMax";i:0;s:16:"mailThrottleTime";i:0;s:12:"customCSSURL";N;s:15:"civiRelativeURL";s:13:"/index.php?q=";s:11:"civiVersion";s:10:"4.4.alpha1";}',
'version' => '4.3.alpha1',
'contact_id' => '2',
'domain_email' => '"Domain Email" <domainemail2@example.org>',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- example demonstrates use of Replace in a nested API call
+/**
+ * Test Generated example of using email replace API
+ * example demonstrates use of Replace in a nested API call *
*/
function email_replace_example(){
$params = array(
- 'version' => 3,
'id' => 10,
'api.email.replace' => array(
'values' => array(
),
);
- $result = civicrm_api( 'email','replace',$params );
+try{
+ $result = civicrm_api3('email', 'replace', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function email_replace_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using email create API
+ * *
*/
function email_create_example(){
$params = array(
'location_type_id' => 6,
'email' => 'api@a-team.com',
'is_primary' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'email','create',$params );
+try{
+ $result = civicrm_api3('email', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function email_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using email delete API
+ * *
*/
function email_delete_example(){
$params = array(
- 'contact_id' => 8,
- 'location_type_id' => 16,
- 'email' => 'api@a-team.com',
- 'is_primary' => 1,
- 'version' => 3,
+ 'id' => 11,
);
- $result = civicrm_api( 'email','delete',$params );
+try{
+ $result = civicrm_api3('email', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function email_delete_expectedresult(){
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using email replace API
+ * *
*/
function email_replace_example(){
$params = array(
- 'version' => 3,
'contact_id' => 9,
'values' => array(
'0' => array(
),
);
- $result = civicrm_api( 'email','replace',$params );
+try{
+ $result = civicrm_api3('email', 'replace', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function email_replace_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using entity_tag create API
+ * *
*/
function entity_tag_create_example(){
$params = array(
'contact_id' => 12,
- 'tag_id' => 1,
- 'version' => 3,
+ 'tag_id' => '1',
);
- $result = civicrm_api( 'entity_tag','create',$params );
+try{
+ $result = civicrm_api3('entity_tag', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function entity_tag_create_expectedresult(){
'total_count' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using entity_tag delete API
+ * *
*/
function entity_tag_delete_example(){
$params = array(
'contact_id_h' => 46,
- 'tag_id' => 1,
- 'version' => 3,
+ 'tag_id' => '1',
);
- $result = civicrm_api( 'entity_tag','delete',$params );
+try{
+ $result = civicrm_api3('entity_tag', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function entity_tag_delete_expectedresult(){
'total_count' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
+<?php
+/**
+ * Test Generated example of using entity_tag get API
+ * *
+ */
+function entity_tag_get_example(){
+$params = array(
+ 'contact_id' => 24,
+ 'tag_id' => '1',
+);
+
+try{
+ $result = civicrm_api3('entity_tag', 'get', $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
+ */
+function entity_tag_get_expectedresult(){
+
+ $expectedResult = array(
+ 'is_error' => 0,
+ 'not_added' => 0,
+ 'added' => 1,
+ 'total_count' => 1,
+);
+
+ 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
+* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/EntityTagTest.php
+*
+* You can see the outcome of the API tests at
+* http://tests.dev.civicrm.org/trunk/results-api_v3
+*
+* To Learn about the API read
+* http://book.civicrm.org/developer/current/techniques/api/
+*
+* and review the wiki at
+* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
+*
+* 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
+*/
\ No newline at end of file
<?php
-
-/*
- demonstrates use of is.Current option
+/**
+ * Test Generated example of using event get API
+ * demonstrates use of is.Current option *
*/
function event_get_example(){
$params = array(
'isCurrent' => 1,
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'event','get',$params );
+try{
+ $result = civicrm_api3('event', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function event_get_expectedresult(){
'event_type_id' => '1',
'participant_listing_id' => 0,
'is_public' => '1',
- 'start_date' => '2013-06-23 00:00:00',
- 'event_start_date' => '2013-06-23 00:00:00',
- 'end_date' => '2013-06-29 00:00:00',
- 'event_end_date' => '2013-06-29 00:00:00',
+ 'start_date' => '2013-07-29 00:00:00',
+ 'event_start_date' => '2013-07-29 00:00:00',
+ 'end_date' => '2013-08-04 00:00:00',
+ 'event_end_date' => '2013-08-04 00:00:00',
'is_online_registration' => '1',
'registration_start_date' => '2010-06-01 00:00:00',
'registration_end_date' => '2010-10-15 00:00:00',
'is_multiple_registrations' => 0,
'allow_same_participant_emails' => 0,
'is_template' => 0,
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'is_share' => '1',
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- demonstrates use of return is_full
+/**
+ * Test Generated example of using event getsingle API
+ * demonstrates use of return is_full *
*/
function event_getsingle_example(){
$params = array(
'id' => 1,
- 'version' => 3,
'return.is_full' => 1,
);
- $result = civicrm_api( 'event','getsingle',$params );
+try{
+ $result = civicrm_api3('event', 'getsingle', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function event_getsingle_expectedresult(){
'is_multiple_registrations' => 0,
'allow_same_participant_emails' => 0,
'is_template' => 0,
- 'created_date' => '2013-06-22 08:49:03',
+ 'created_date' => '2013-07-28 08:49:19',
'is_share' => '1',
'available_places' => 0,
'is_full' => '1',
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using event create API
+ * *
*/
function event_create_example(){
$params = array(
'is_monetary' => 0,
'is_active' => 1,
'is_show_location' => 0,
- 'version' => 3,
);
- $result = civicrm_api( 'event','create',$params );
+try{
+ $result = civicrm_api3('event', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function event_create_expectedresult(){
'is_template' => 0,
'template_title' => '',
'created_id' => '',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'currency' => '',
'campaign_id' => '',
'is_share' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using event delete API
+ * *
*/
function event_delete_example(){
$params = array(
'id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'event','delete',$params );
+try{
+ $result = civicrm_api3('event', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function event_delete_expectedresult(){
'values' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using event get API
+ * *
*/
function event_get_example(){
$params = array(
'event_title' => 'Annual CiviCRM meet',
'sequential' => true,
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'event','get',$params );
+try{
+ $result = civicrm_api3('event', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function event_get_expectedresult(){
'is_multiple_registrations' => 0,
'allow_same_participant_emails' => 0,
'is_template' => 0,
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'is_share' => '1',
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
+++ /dev/null
-<?php
-
-/*
-
- */
-function event_update_example(){
-$params = array(
- '0' => array(
- 'title' => 'Annual CiviCRM meet',
- 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now',
- 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
- 'event_type_id' => 1,
- 'is_public' => 1,
- 'start_date' => 20081021,
- 'end_date' => 20081023,
- 'is_online_registration' => 1,
- 'registration_start_date' => 20080601,
- 'registration_end_date' => '2008-10-15',
- 'max_participants' => 100,
- 'event_full_text' => 'Sorry! We are already full',
- 'is_monetary' => 0,
- 'is_active' => 1,
- 'is_show_location' => 0,
- 'version' => 3,
- ),
- '1' => array(
- 'title' => 'Annual CiviCRM meet 2',
- 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now',
- 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
- 'event_type_id' => 1,
- 'is_public' => 1,
- 'start_date' => 20101021,
- 'end_date' => 20101023,
- 'is_online_registration' => 1,
- 'registration_start_date' => 20100601,
- 'registration_end_date' => '2010-10-15',
- 'max_participants' => 100,
- 'event_full_text' => 'Sorry! We are already full',
- 'is_monetory' => 0,
- 'is_active' => 1,
- 'is_show_location' => 0,
- 'version' => 3,
- ),
-);
-
- $result = civicrm_api( 'event','update',$params );
-
- return $result;
-}
-
-/*
- * Function returns array of result expected from previous function
- */
-function event_update_expectedresult(){
-
- $expectedResult = array(
- 'is_error' => 0,
- 'version' => 3,
- 'count' => 1,
- 'id' => 3,
- 'values' => array(
- '3' => array(
- 'id' => '3',
- 'title' => 'Annual CiviCRM meet 2',
- 'event_title' => 'Annual CiviCRM meet 2',
- 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now',
- 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
- 'event_description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
- 'event_type_id' => '1',
- 'participant_listing_id' => 0,
- 'is_public' => '1',
- 'start_date' => '2010-10-21 00:00:00',
- 'event_start_date' => '2010-10-21 00:00:00',
- 'end_date' => '2010-10-23 00:00:00',
- 'event_end_date' => '2010-10-23 00:00:00',
- 'is_online_registration' => '1',
- 'registration_start_date' => '2010-06-01 00:00:00',
- 'registration_end_date' => '2010-10-15 00:00:00',
- 'max_participants' => '150',
- 'event_full_text' => 'Sorry! We are already full',
- 'is_monetary' => 0,
- 'is_map' => 0,
- 'is_active' => '1',
- 'is_show_location' => 0,
- 'default_role_id' => '1',
- 'is_email_confirm' => 0,
- 'is_pay_later' => 0,
- 'is_partial_payment' => 0,
- 'is_multiple_registrations' => 0,
- 'allow_same_participant_emails' => 0,
- 'is_template' => 0,
- 'created_date' => '20120130621222105',
- 'is_share' => '1',
- ),
- ),
-);
-
- return $expectedResult ;
-}
-
-
-/*
-* This example has been generated from the API test suite. The test that created it is called
-*
-* testUpdateEvent and can be found in
-* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/EventTest.php
-*
-* You can see the outcome of the API tests at
-* http://tests.dev.civicrm.org/trunk/results-api_v3
-*
-* To Learn about the API read
-* http://book.civicrm.org/developer/current/techniques/api/
-*
-* and review the wiki at
-* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
-*
-* 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
-*/
\ No newline at end of file
<?php
-
-/*
-
+/**
+ * Test Generated example of using grant create API
+ * *
*/
function grant_create_example(){
$params = array(
- 'version' => 3,
'contact_id' => 3,
'application_received_date' => 'now',
'decision_date' => 'next Monday',
'grant_type_id' => 1,
);
- $result = civicrm_api( 'grant','create',$params );
+try{
+ $result = civicrm_api3('grant', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function grant_create_expectedresult(){
'1' => array(
'id' => '1',
'contact_id' => '3',
- 'application_received_date' => '20130622084947',
- 'decision_date' => '20130624000000',
+ 'application_received_date' => '20130728084957',
+ 'decision_date' => '20130729000000',
'money_transfer_date' => '',
'grant_due_date' => '',
'grant_report_received' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using grant delete API
+ * *
*/
function grant_delete_example(){
$params = array(
- 'version' => 3,
- 'contact_id' => 5,
- 'application_received_date' => 'now',
- 'decision_date' => 'next Monday',
- 'amount_total' => '500',
- 'status_id' => 1,
- 'rationale' => 'Just Because',
- 'currency' => 'USD',
- 'grant_type_id' => 1,
+ 'id' => 3,
);
- $result = civicrm_api( 'grant','delete',$params );
+try{
+ $result = civicrm_api3('grant', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function grant_delete_expectedresult(){
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using grant get API
+ * *
*/
function grant_get_example(){
$params = array(
- 'version' => 3,
- 'contact_id' => 4,
- 'application_received_date' => 'now',
- 'decision_date' => 'next Monday',
- 'amount_total' => '500',
- 'status_id' => 1,
'rationale' => 'Just Because',
- 'currency' => 'USD',
- 'grant_type_id' => 1,
);
- $result = civicrm_api( 'grant','get',$params );
+try{
+ $result = civicrm_api3('grant', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function grant_get_expectedresult(){
'2' => array(
'id' => '2',
'contact_id' => '4',
- 'application_received_date' => '2013-06-22',
- 'decision_date' => '2013-06-24',
+ 'application_received_date' => '2013-07-28',
+ 'decision_date' => '2013-07-29',
'grant_type_id' => '1',
'amount_total' => '500.00',
'currency' => 'USD',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- demonstrate use of getfields to interogate api
+/**
+ * Test Generated example of using group getfields API
+ * demonstrate use of getfields to interogate api *
*/
function group_getfields_example(){
$params = array(
- 'version' => 3,
'action' => 'create',
);
- $result = civicrm_api( 'group','getfields',$params );
+try{
+ $result = civicrm_api3('group', 'getfields', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function group_getfields_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
+++ /dev/null
-<?php
-
-function group_contact__example() {
- $params = array(
- 'contact_id' => '1',
- 'group_id' => '1',
- 'version' => '3',
- );
- require_once 'api/api.php';
- $result = civicrm_api('group_contact', '', $params);
-
- return $result;
-}
-
-/*
- * Function returns array of result expected from previous function
- */
-function group_contact__expectedresult() {
-
- $expectedResult = array(
- 'is_error' => '0',
- 'version' => '3',
- 'count' => '4',
- 'values' => array(
- 'is_error' => '0', 'not_removed' => '0', 'removed' => '1', 'total_count' => '1',
- ),
- );
-
- return $expectedResult;
-}
-
<?php
-
-/*
- Get all from group and display contacts
+/**
+ * Test Generated example of using group_contact get API
+ * Get all from group and display contacts *
*/
function group_contact_get_example(){
$params = array(
'group_id' => 1,
- 'version' => 3,
'api.group.get' => 1,
'sequential' => 1,
);
- $result = civicrm_api( 'group_contact','get',$params );
+try{
+ $result = civicrm_api3('group_contact', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function group_contact_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using group_contact create API
+ * *
*/
function group_contact_create_example(){
$params = array(
'contact_id' => 1,
'contact_id.2' => 2,
'group_id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'group_contact','create',$params );
+try{
+ $result = civicrm_api3('group_contact', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function group_contact_create_expectedresult(){
'not_added' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using group_contact delete API
+ * *
*/
function group_contact_delete_example(){
$params = array(
'contact_id' => 1,
'group_id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'group_contact','delete',$params );
+try{
+ $result = civicrm_api3('group_contact', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function group_contact_delete_expectedresult(){
'not_removed' => 0,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using group_contact get API
+ * *
*/
function group_contact_get_example(){
$params = array(
'contact_id' => 3,
- 'version' => 3,
);
- $result = civicrm_api( 'group_contact','get',$params );
+try{
+ $result = civicrm_api3('group_contact', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function group_contact_get_expectedresult(){
'title' => 'New Test Group Created',
'visibility' => 'Public Pages',
'is_hidden' => 0,
- 'in_date' => '2013-06-22 08:50:14',
+ 'in_date' => '2013-07-28 08:50:19',
'in_method' => 'API',
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using group get API
+ * *
*/
function group_get_example(){
$params = array(
- 'version' => 3,
- 'name' => 'Test Group 1_5',
+ 'name' => 'Test Group 1_4',
);
- $result = civicrm_api( 'group','get',$params );
+try{
+ $result = civicrm_api3('group', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function group_get_expectedresult(){
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'id' => 5,
+ 'id' => 4,
'values' => array(
- '5' => array(
- 'id' => '5',
- 'name' => 'Test Group 1_5',
+ '4' => array(
+ 'id' => '4',
+ 'name' => 'Test Group 1_4',
'title' => 'New Test Group Created',
'description' => 'New Test Group Created',
'source' => '',
'saved_search_id' => '',
'is_active' => '1',
'visibility' => 'Public Pages',
- 'where_clause' => ' ( `civicrm_group_contact-5`.group_id IN ( 5 ) AND `civicrm_group_contact-5`.status IN ("Added") ) ',
- 'select_tables' => 'a:9:{s:15:"civicrm_contact";i:1;s:15:"civicrm_address";i:1;s:22:"civicrm_state_province";i:1;s:15:"civicrm_country";i:1;s:13:"civicrm_email";i:1;s:13:"civicrm_phone";i:1;s:10:"civicrm_im";i:1;s:19:"civicrm_worldregion";i:1;s:25:"`civicrm_group_contact-5`";s:114:" LEFT JOIN civicrm_group_contact `civicrm_group_contact-5` ON contact_a.id = `civicrm_group_contact-5`.contact_id ";}',
- 'where_tables' => 'a:2:{s:15:"civicrm_contact";i:1;s:25:"`civicrm_group_contact-5`";s:114:" LEFT JOIN civicrm_group_contact `civicrm_group_contact-5` ON contact_a.id = `civicrm_group_contact-5`.contact_id ";}',
+ 'where_clause' => ' ( `civicrm_group_contact-4`.group_id IN ( 4 ) AND `civicrm_group_contact-4`.status IN ("Added") ) ',
+ 'select_tables' => 'a:9:{s:15:"civicrm_contact";i:1;s:15:"civicrm_address";i:1;s:22:"civicrm_state_province";i:1;s:15:"civicrm_country";i:1;s:13:"civicrm_email";i:1;s:13:"civicrm_phone";i:1;s:10:"civicrm_im";i:1;s:19:"civicrm_worldregion";i:1;s:25:"`civicrm_group_contact-4`";s:114:" LEFT JOIN civicrm_group_contact `civicrm_group_contact-4` ON contact_a.id = `civicrm_group_contact-4`.contact_id ";}',
+ 'where_tables' => 'a:2:{s:15:"civicrm_contact";i:1;s:25:"`civicrm_group_contact-4`";s:114:" LEFT JOIN civicrm_group_contact `civicrm_group_contact-4` ON contact_a.id = `civicrm_group_contact-4`.contact_id ";}',
'group_type' => array(
'0' => '1',
'1' => '2',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using group_nesting create API
+ * *
*/
function group_nesting_create_example(){
$params = array(
'parent_group_id' => 1,
'child_group_id' => 3,
- 'version' => 3,
);
- $result = civicrm_api( 'group_nesting','create',$params );
+try{
+ $result = civicrm_api3('group_nesting', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function group_nesting_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using group_nesting delete API
+ * *
*/
function group_nesting_delete_example(){
$params = array(
- 'version' => 3,
'id' => 1,
);
- $result = civicrm_api( 'group_nesting','delete',$params );
+try{
+ $result = civicrm_api3('group_nesting', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function group_nesting_delete_expectedresult(){
'values' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using group_nesting get API
+ * *
*/
function group_nesting_get_example(){
$params = array(
'parent_group_id' => 1,
'child_group_id' => 2,
- 'version' => 3,
);
- $result = civicrm_api( 'group_nesting','get',$params );
+try{
+ $result = civicrm_api3('group_nesting', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function group_nesting_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using group_organization create API
+ * *
*/
function group_organization_create_example(){
$params = array(
'organization_id' => 1,
'group_id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'group_organization','create',$params );
+try{
+ $result = civicrm_api3('group_organization', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function group_organization_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using group_organization delete API
+ * *
*/
function group_organization_delete_example(){
$params = array(
'id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'group_organization','delete',$params );
+try{
+ $result = civicrm_api3('group_organization', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function group_organization_delete_expectedresult(){
'values' => 'Deleted Group Organization successfully',
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using group_organization get API
+ * *
*/
function group_organization_get_example(){
$params = array(
'organization_id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'group_organization','get',$params );
+try{
+ $result = civicrm_api3('group_organization', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function group_organization_get_expectedresult(){
'values' => array(),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using im create API
+ * *
*/
function im_create_example(){
$params = array(
- 'version' => 3,
'contact_id' => 3,
'name' => 'My Yahoo IM Handle',
'location_type_id' => 1,
'provider_id' => 1,
);
- $result = civicrm_api( 'im','create',$params );
+try{
+ $result = civicrm_api3('im', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function im_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using im delete API
+ * *
*/
function im_delete_example(){
$params = array(
- 'version' => 3,
'id' => 1,
);
- $result = civicrm_api( 'im','delete',$params );
+try{
+ $result = civicrm_api3('im', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function im_delete_expectedresult(){
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using im get API
+ * *
*/
function im_get_example(){
$params = array(
- 'version' => 3,
'contact_id' => 1,
'name' => 'My Yahoo IM Handle',
'location_type_id' => 1,
'provider_id' => 1,
);
- $result = civicrm_api( 'im','get',$params );
+try{
+ $result = civicrm_api3('im', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function im_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using job create API
+ * *
*/
function job_create_example(){
$params = array(
- 'version' => 3,
'sequential' => 1,
'name' => 'API_Test_Job',
'description' => 'A long description written by hand in cursive',
'is_active' => 1,
);
- $result = civicrm_api( 'job','create',$params );
+try{
+ $result = civicrm_api3('job', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function job_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using job delete API
+ * *
*/
function job_delete_example(){
$params = array(
'id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'job','delete',$params );
+try{
+ $result = civicrm_api3('job', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function job_delete_expectedresult(){
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using line_item create API
+ * *
*/
function line_item_create_example(){
$params = array(
- 'version' => 3,
'price_field_value_id' => 1,
'price_field_id' => 1,
'entity_table' => 'civicrm_contribution',
'qty' => 1,
'unit_price' => 50,
'line_total' => 50,
+ 'debug' => 1,
);
- $result = civicrm_api( 'line_item','create',$params );
+try{
+ $result = civicrm_api3('line_item', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function line_item_create_expectedresult(){
$expectedResult = array(
'is_error' => 0,
- 'undefined_fields' => array(
- '0' => 'label',
- '1' => 'price_field_value_id',
- '2' => 'price_field_id',
- '3' => 'entity_table',
- '4' => 'entity_id',
- '5' => 'qty',
- '6' => 'unit_price',
- '7' => 'line_total',
- ),
'version' => 3,
'count' => 1,
'id' => 1,
'deductible_amount' => '',
),
),
- 'xdebug' => array(
- 'peakMemory' => 144948640,
- 'memory' => 131358352,
- 'timeIndex' => '1877.7615101337',
- ),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using line_item delete API
+ * *
*/
function line_item_delete_example(){
$params = array(
- 'version' => 3,
'id' => 1,
);
- $result = civicrm_api( 'line_item','delete',$params );
+try{
+ $result = civicrm_api3('line_item', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function line_item_delete_expectedresult(){
'values' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using line_item get API
+ * *
*/
function line_item_get_example(){
$params = array(
- 'version' => 3,
'entity_table' => 'civicrm_contribution',
);
- $result = civicrm_api( 'line_item','get',$params );
+try{
+ $result = civicrm_api3('line_item', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function line_item_get_expectedresult(){
'unit_price' => '100.00',
'line_total' => '100.00',
'price_field_value_id' => '1',
- 'financial_type_id' => '3',
+ 'financial_type_id' => '1',
'deductible_amount' => '0.00',
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using loc_block create API
+ * *
*/
function loc_block_create_example(){
$params = array(
'email_id' => 3,
);
- $result = civicrm_api( 'loc_block','create',$params );
+try{
+ $result = civicrm_api3('loc_block', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function loc_block_create_expectedresult(){
'im_2_id' => '',
),
),
- 'xdebug' => array(
- 'peakMemory' => 145366376,
- 'memory' => 131621280,
- 'timeIndex' => '1882.6170191765',
- ),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Create entities and location block in 1 api call
+/**
+ * Test Generated example of using loc_block createEntities API
+ * Create entities and location block in 1 api call *
*/
function loc_block_createentities_example(){
$params = array(
'location_type_id' => 1,
'street_address' => '987654321',
),
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'loc_block','createEntities',$params );
+try{
+ $result = civicrm_api3('loc_block', 'createEntities', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function loc_block_createentities_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Get entities and location block in 1 api call
+/**
+ * Test Generated example of using loc_block get API
+ * Get entities and location block in 1 api call *
*/
function loc_block_get_example(){
$params = array(
- 'version' => 3,
'id' => 3,
'return' => 'all',
);
- $result = civicrm_api( 'loc_block','get',$params );
+try{
+ $result = civicrm_api3('loc_block', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function loc_block_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- demonstrates get + delete in the same call
+/**
+ * Test Generated example of using mail_settings get API
+ * demonstrates get + delete in the same call *
*/
function mail_settings_get_example(){
$params = array(
- 'version' => 3,
'title' => 'MailSettings title',
'api.MailSettings.delete' => 1,
);
- $result = civicrm_api( 'mail_settings','get',$params );
+try{
+ $result = civicrm_api3('mail_settings', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function mail_settings_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using mail_settings create API
+ * *
*/
function mail_settings_create_example(){
$params = array(
'server' => 'localhost',
'username' => 'sue',
'password' => 'pass',
- 'version' => 3,
);
- $result = civicrm_api( 'mail_settings','create',$params );
+try{
+ $result = civicrm_api3('mail_settings', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function mail_settings_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using mail_settings delete API
+ * *
*/
function mail_settings_delete_example(){
$params = array(
- 'domain_id' => 1,
- 'name' => 'my mail setting',
- 'domain' => 'setting.com',
- 'local_part' => 'civicrm+',
- 'server' => 'localhost',
- 'username' => 'sue',
- 'password' => 'pass',
- 'version' => 3,
+ 'id' => 2,
);
- $result = civicrm_api( 'mail_settings','delete',$params );
+try{
+ $result = civicrm_api3('mail_settings', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function mail_settings_delete_expectedresult(){
'values' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using mail_settings get API
+ * *
*/
function mail_settings_get_example(){
$params = array(
'server' => 'localhost',
'username' => 'sue',
'password' => 'pass',
- 'version' => 3,
);
- $result = civicrm_api( 'mail_settings','get',$params );
+try{
+ $result = civicrm_api3('mail_settings', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function mail_settings_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using mailing create API
+ * *
*/
function mailing_create_example(){
$params = array(
'subject' => 'maild',
'body_text' => 'bdkfhdskfhduew',
- 'version' => 3,
'name' => 'mailing name',
'created_id' => 1,
);
- $result = civicrm_api( 'mailing','create',$params );
+try{
+ $result = civicrm_api3('mailing', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function mailing_create_expectedresult(){
'msg_template_id' => '',
'override_verp' => '1',
'created_id' => '1',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'scheduled_id' => '',
- 'scheduled_date' => '20130622085501',
+ 'scheduled_date' => '20130728085413',
'approver_id' => '1',
- 'approval_date' => '20130622085501',
+ 'approval_date' => '20130728085413',
'approval_status_id' => '',
'approval_note' => '',
'is_archived' => '',
'0' => array(
'id' => '1',
'mailing_id' => '1',
- 'scheduled_date' => '20130622085501',
+ 'scheduled_date' => '20130728085413',
'start_date' => '',
'end_date' => '',
'status' => 'Scheduled',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using mailing delete API
+ * *
*/
-function activity_type_delete_example(){
+function mailing_delete_example(){
$params = array(
- 'activity_type_id' => 724,
- 'version' => 3,
+ 'id' => 2,
);
- $result = civicrm_api( 'activity_type','delete',$params );
+try{
+ $result = civicrm_api3('mailing', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
-function activity_type_delete_expectedresult(){
+function mailing_delete_expectedresult(){
$expectedResult = array(
- 'is_error' => 1,
- 'error_message' => 'Undefined index: activity_type_id',
+ 'is_error' => 0,
+ 'version' => 3,
+ 'count' => 1,
+ 'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
/*
* This example has been generated from the API test suite. The test that created it is called
*
-* testActivityTypeDelete and can be found in
-* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ActivityTypeTest.php
+* testMailerDeleteSuccess and can be found in
+* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/MailingTest.php
*
* You can see the outcome of the API tests at
* http://tests.dev.civicrm.org/trunk/results-api_v3
<?php
-
-/*
-
+/**
+ * Test Generated example of using mailing_group subscribe API
+ * *
*/
function mailing_group_subscribe_example(){
$params = array(
'email' => 'test@test.test',
'group_id' => 2,
'contact_id' => 3,
- 'version' => 3,
'hash' => 'b15de8b64e2cec34',
'time_stamp' => '20101212121212',
);
- $result = civicrm_api( 'mailing_group','subscribe',$params );
+try{
+ $result = civicrm_api3('mailing_group', 'subscribe', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function mailing_group_subscribe_expectedresult(){
'values' => array(
'contact_id' => '3',
'subscribe_id' => '1',
- 'hash' => '5b056fa32d2d56c6',
+ 'hash' => 'fcf4e727e2a34e5d',
'is_error' => 0,
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Demonstrates use of 'filter' active_only' param
+/**
+ * Test Generated example of using membership get API
+ * Demonstrates use of 'filter' active_only' param *
*/
function membership_get_example(){
$params = array(
'filters' => array(
'is_current' => 1,
),
- 'version' => 3,
);
- $result = civicrm_api( 'membership','get',$params );
+try{
+ $result = civicrm_api3('membership', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function membership_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using membership create API
+ * *
*/
function membership_create_example(){
$params = array(
- 'contact_id' => 26,
- 'membership_type_id' => 23,
+ 'contact_id' => 25,
+ 'membership_type_id' => 22,
'join_date' => '2009-01-21',
'start_date' => '2009-01-21',
'end_date' => '2009-12-21',
'source' => 'Payment',
'is_override' => 1,
- 'status_id' => 29,
- 'version' => 3,
- 'custom_2' => 'custom string',
+ 'status_id' => 28,
+ 'custom_1' => 'custom string',
);
- $result = civicrm_api( 'membership','create',$params );
+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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function membership_create_expectedresult(){
'values' => array(
'1' => array(
'id' => '1',
- 'contact_id' => '26',
- 'membership_type_id' => '23',
+ 'contact_id' => '25',
+ 'membership_type_id' => '22',
'join_date' => '20090121000000',
'start_date' => '20090121000000',
'end_date' => '20091221000000',
'source' => 'Payment',
- 'status_id' => '29',
+ 'status_id' => '28',
'is_override' => '1',
'owner_membership_id' => '',
'max_related' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using membership delete API
+ * *
*/
function membership_delete_example(){
$params = array(
'id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'membership','delete',$params );
+try{
+ $result = civicrm_api3('membership', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function membership_delete_expectedresult(){
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'values' => 1,
+ 'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using membership get API
+ * *
*/
function membership_get_example(){
$params = array(
- 'version' => 3,
'membership_type_id' => 8,
);
- $result = civicrm_api( 'membership','get',$params );
+try{
+ $result = civicrm_api3('membership', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function membership_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using membership_payment create API
+ * *
*/
function membership_payment_create_example(){
$params = array(
'contribution_id' => 1,
'membership_id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'membership_payment','create',$params );
+try{
+ $result = civicrm_api3('membership_payment', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function membership_payment_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using membership_payment get API
+ * *
*/
function membership_payment_get_example(){
$params = array(
'contribution_id' => 1,
'membership_id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'membership_payment','get',$params );
+try{
+ $result = civicrm_api3('membership_payment', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function membership_payment_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using membership_status create API
+ * *
*/
function membership_status_create_example(){
$params = array(
'name' => 'test membership status',
- 'version' => 3,
);
- $result = civicrm_api( 'membership_status','create',$params );
+try{
+ $result = civicrm_api3('membership_status', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function membership_status_create_expectedresult(){
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'id' => 19,
+ 'id' => 15,
'values' => array(
- '19' => array(
- 'id' => '19',
+ '15' => array(
+ 'id' => '15',
'name' => 'test membership status',
'label' => 'test membership status',
'start_event' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using membership_status get API
+ * *
*/
function membership_status_get_example(){
$params = array(
'name' => 'test status',
- 'version' => 3,
);
- $result = civicrm_api( 'membership_status','get',$params );
+try{
+ $result = civicrm_api3('membership_status', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function membership_status_get_expectedresult(){
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'id' => 10,
+ 'id' => 9,
'values' => array(
- '10' => array(
- 'id' => '10',
+ '9' => array(
+ 'id' => '9',
'name' => 'test status',
'label' => 'test status',
'start_event' => 'start_date',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using membership_type create API
+ * *
*/
function membership_type_create_example(){
$params = array(
'duration_interval' => '10',
'period_type' => 'rolling',
'visibility' => 'public',
- 'version' => 3,
);
- $result = civicrm_api( 'membership_type','create',$params );
+try{
+ $result = civicrm_api3('membership_type', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function membership_type_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using membership_type delete API
+ * *
*/
function membership_type_delete_example(){
$params = array(
'id' => 4,
- 'version' => 3,
);
- $result = civicrm_api( 'membership_type','delete',$params );
+try{
+ $result = civicrm_api3('membership_type', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function membership_type_delete_expectedresult(){
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using membership_type get API
+ * *
*/
function membership_type_get_example(){
$params = array(
'id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'membership_type','get',$params );
+try{
+ $result = civicrm_api3('membership_type', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function membership_type_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using membership update API
+ * *
*/
function membership_update_example(){
$params = array(
- 'contact_id' => 32,
- 'membership_type_id' => 29,
+ 'contact_id' => 31,
+ 'membership_type_id' => 28,
'join_date' => '2009-01-21',
'start_date' => '2009-01-21',
'end_date' => '2009-12-21',
'source' => 'Payment',
'is_override' => 1,
- 'status_id' => 35,
- 'version' => 3,
- 'custom_3' => 'custom string',
+ 'status_id' => 34,
+ 'custom_1' => 'custom string',
);
- $result = civicrm_api( 'membership','update',$params );
+try{
+ $result = civicrm_api3('membership', 'update', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function membership_update_expectedresult(){
'values' => array(
'1' => array(
'id' => '1',
- 'contact_id' => '32',
- 'membership_type_id' => '29',
+ 'contact_id' => '31',
+ 'membership_type_id' => '28',
'join_date' => '20090121000000',
'start_date' => '20090121000000',
'end_date' => '20091221000000',
'source' => 'Payment',
- 'status_id' => '35',
+ 'status_id' => '34',
'is_override' => '1',
'owner_membership_id' => '',
'max_related' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using note create API
+ * *
*/
function note_create_example(){
$params = array(
'contact_id' => 1,
'modified_date' => '2011-01-31',
'subject' => 'Test Note',
- 'version' => 3,
);
- $result = civicrm_api( 'note','create',$params );
+try{
+ $result = civicrm_api3('note', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function note_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using note delete API
+ * *
*/
function note_delete_example(){
$params = array(
'id' => 2,
- 'version' => 3,
);
- $result = civicrm_api( 'note','delete',$params );
+try{
+ $result = civicrm_api3('note', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function note_delete_expectedresult(){
'values' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using note get API
+ * *
*/
function note_get_example(){
$params = array(
'entity_table' => 'civicrm_contact',
'entity_id' => 1,
- 'note' => 'Hello!!! m testing Note',
- 'contact_id' => 1,
- 'modified_date' => '2011-01-31',
- 'subject' => 'Test Note',
- 'version' => 3,
);
- $result = civicrm_api( 'note','get',$params );
+try{
+ $result = civicrm_api3('note', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function note_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using option_group create API
+ * *
*/
function option_group_create_example(){
$params = array(
- 'version' => 3,
'sequential' => 1,
'name' => 'civicrm_event.amount.560',
'is_reserved' => 1,
'is_active' => 1,
'format.only_id' => 1,
),
- 'debug' => 0,
);
- $result = civicrm_api( 'option_group','create',$params );
+try{
+ $result = civicrm_api3('option_group', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function option_group_create_expectedresult(){
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'id' => 84,
+ 'id' => 86,
'values' => array(
'0' => array(
- 'id' => '84',
+ 'id' => '86',
'name' => 'civicrm_event.amount.560',
'title' => '',
'description' => '',
'is_reserved' => '1',
'is_active' => '1',
- 'api.OptionValue.create' => 720,
+ 'api.OptionValue.create' => 722,
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using option_group delete API
+ * *
*/
function option_group_delete_example(){
$params = array(
- 'id' => 89,
- 'version' => 3,
- 'debug' => 0,
+ 'id' => 91,
);
- $result = civicrm_api( 'option_group','delete',$params );
+try{
+ $result = civicrm_api3('option_group', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function option_group_delete_expectedresult(){
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using option_group get API
+ * *
*/
function option_group_get_example(){
$params = array(
'name' => 'preferred_communication_method',
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'option_group','get',$params );
+try{
+ $result = civicrm_api3('option_group', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function option_group_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- demonstrates use of Sort param (available in many api functions). Also, getsingle
+/**
+ * Test Generated example of using option_value getsingle API
+ * demonstrates use of Sort param (available in many api functions). Also, getsingle *
*/
function option_value_getsingle_example(){
$params = array(
'option_group_id' => 1,
- 'version' => 3,
'options' => array(
'sort' => 'label DESC',
'limit' => 1,
),
);
- $result = civicrm_api( 'option_value','getsingle',$params );
+try{
+ $result = civicrm_api3('option_value', 'getsingle', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function option_value_getsingle_expectedresult(){
'is_active' => '1',
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using option_value get API
+ * *
*/
function option_value_get_example(){
$params = array(
'option_group_id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'option_value','get',$params );
+try{
+ $result = civicrm_api3('option_value', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function option_value_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- single function to create contact w partipation & contribution. Note that in the
- case of 'contribution' the 'create' is implied (api.contribution.create)
+/**
+ * Test Generated example of using participant create API
+ * single function to create contact w partipation & contribution. Note that in the
+ case of 'contribution' the 'create' is implied (api.contribution.create) *
*/
function participant_create_example(){
$params = array(
'contact_type' => 'Individual',
'display_name' => 'dlobo',
- 'version' => 3,
'api.participant' => array(
- 'event_id' => 38,
+ 'event_id' => 39,
'status_id' => 1,
'role_id' => 1,
'format.only_id' => 1,
),
);
- $result = civicrm_api( 'participant','create',$params );
+try{
+ $result = civicrm_api3('participant', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function participant_create_expectedresult(){
'first_name' => '',
'middle_name' => '',
'last_name' => '',
- 'prefix_id' => '',
- 'suffix_id' => '',
'email_greeting_id' => '1',
'email_greeting_custom' => '',
'email_greeting_display' => '',
'organization_name' => '',
'sic_code' => '',
'user_unique_id' => '',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'modified_date' => '2012-11-14 16:02:35',
'api.participant' => 4,
'api.contribution.create' => 1,
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Criteria delete by nesting a GET & a DELETE
+/**
+ * Test Generated example of using participant Get API
+ * Criteria delete by nesting a GET & a DELETE *
*/
function participant_get_example(){
$params = array(
- 'version' => 3,
'contact_id' => 4,
'api.participant.delete' => 1,
);
- $result = civicrm_api( 'participant','Get',$params );
+try{
+ $result = civicrm_api3('participant', 'Get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function participant_get_expectedresult(){
'contact_sub_type' => '',
'sort_name' => 'Anderson, Anthony',
'display_name' => 'Mr. Anthony Anderson II',
- 'event_id' => '37',
+ 'event_id' => '38',
'event_title' => 'Annual CiviCRM meet',
'event_start_date' => '2008-10-21 00:00:00',
'event_end_date' => '2008-10-23 00:00:00',
'contact_sub_type' => '',
'sort_name' => 'Anderson, Anthony',
'display_name' => 'Mr. Anthony Anderson II',
- 'event_id' => '37',
+ 'event_id' => '38',
'event_title' => 'Annual CiviCRM meet',
'event_start_date' => '2008-10-21 00:00:00',
'event_end_date' => '2008-10-23 00:00:00',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- use nested get to get an event
+/**
+ * Test Generated example of using participant get API
+ * use nested get to get an event *
*/
function participant_get_example(){
$params = array(
'id' => 1,
- 'version' => 3,
'api.event.get' => 1,
);
- $result = civicrm_api( 'participant','get',$params );
+try{
+ $result = civicrm_api3('participant', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function participant_get_expectedresult(){
'is_multiple_registrations' => 0,
'allow_same_participant_emails' => 0,
'is_template' => 0,
- 'created_date' => '2013-06-22 09:01:44',
+ 'created_date' => '2013-07-28 05:52:14',
'is_share' => '1',
),
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using participant create API
+ * *
*/
function participant_create_example(){
$params = array(
'role_id' => 1,
'register_date' => '2007-07-21 00:00:00',
'source' => 'Online Event Registration: API Testing',
- 'version' => 3,
'custom_1' => 'custom string',
);
- $result = civicrm_api( 'participant','create',$params );
+try{
+ $result = civicrm_api3('participant', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function participant_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using participant get API
+ * *
*/
function participant_get_example(){
$params = array(
'id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'participant','get',$params );
+try{
+ $result = civicrm_api3('participant', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function participant_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using participant_payment create API
+ * *
*/
function participant_payment_create_example(){
$params = array(
'participant_id' => 1,
'contribution_id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'participant_payment','create',$params );
+try{
+ $result = civicrm_api3('participant_payment', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function participant_payment_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using participant_payment delete API
+ * *
*/
function participant_payment_delete_example(){
$params = array(
'id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'participant_payment','delete',$params );
+try{
+ $result = civicrm_api3('participant_payment', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function participant_payment_delete_expectedresult(){
'values' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using participant_payment get API
+ * *
*/
function participant_payment_get_example(){
$params = array(
'participant_id' => 4,
'contribution_id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'participant_payment','get',$params );
+try{
+ $result = civicrm_api3('participant_payment', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function participant_payment_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using participant_status_type create API
+ * *
*/
function participant_status_type_create_example(){
$params = array(
- 'version' => 3,
'name' => 'test status',
'label' => 'I am a test',
'class' => 'Positive',
'weight' => 10,
);
- $result = civicrm_api( 'participant_status_type','create',$params );
+try{
+ $result = civicrm_api3('participant_status_type', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function participant_status_type_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using participant_status_type delete API
+ * *
*/
function participant_status_type_delete_example(){
$params = array(
- 'version' => 3,
- 'name' => 'test status',
- 'label' => 'I am a test',
- 'class' => 'Positive',
- 'is_reserved' => 0,
- 'is_active' => 1,
- 'is_counted' => 1,
- 'visibility_id' => 1,
- 'weight' => 10,
+ 'id' => 15,
);
- $result = civicrm_api( 'participant_status_type','delete',$params );
+try{
+ $result = civicrm_api3('participant_status_type', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function participant_status_type_delete_expectedresult(){
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using participant_status_type get API
+ * *
*/
function participant_status_type_get_example(){
$params = array(
- 'version' => 3,
'name' => 'test status',
'label' => 'I am a test',
'class' => 'Positive',
'weight' => 10,
);
- $result = civicrm_api( 'participant_status_type','get',$params );
+try{
+ $result = civicrm_api3('participant_status_type', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function participant_status_type_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using payment_processor create API
+ * *
*/
function payment_processor_create_example(){
$params = array(
- 'version' => 3,
'name' => 'API Test PP',
'payment_processor_type_id' => 1,
'class_name' => 'CRM_Core_Payment_APITest',
'domain_id' => 1,
);
- $result = civicrm_api( 'payment_processor','create',$params );
+try{
+ $result = civicrm_api3('payment_processor', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function payment_processor_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using payment_processor delete API
+ * *
*/
function payment_processor_delete_example(){
$params = array(
'id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'payment_processor','delete',$params );
+try{
+ $result = civicrm_api3('payment_processor', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function payment_processor_delete_expectedresult(){
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using payment_processor_type create API
+ * *
*/
function payment_processor_type_create_example(){
$params = array(
- 'version' => 3,
'sequential' => 1,
'name' => 'API_Test_PP',
'title' => 'API Test Payment Processor',
'is_recur' => 0,
);
- $result = civicrm_api( 'payment_processor_type','create',$params );
+try{
+ $result = civicrm_api3('payment_processor_type', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function payment_processor_type_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using payment_processor_type delete API
+ * *
*/
function payment_processor_type_delete_example(){
$params = array(
'id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'payment_processor_type','delete',$params );
+try{
+ $result = civicrm_api3('payment_processor_type', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function payment_processor_type_delete_expectedresult(){
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using phone create API
+ * *
*/
function phone_create_example(){
$params = array(
'location_type_id' => 6,
'phone' => '(123) 456-7890',
'is_primary' => 1,
- 'version' => 3,
'phone_type_id' => 1,
);
- $result = civicrm_api( 'phone','create',$params );
+try{
+ $result = civicrm_api3('phone', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function phone_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using phone delete API
+ * *
*/
function phone_delete_example(){
$params = array(
- 'contact_id' => 4,
- 'location_type_id' => 7,
- 'phone' => '(123) 456-7890',
- 'is_primary' => 1,
- 'version' => 3,
- 'phone_type_id' => 1,
+ 'id' => 1,
);
- $result = civicrm_api( 'phone','delete',$params );
+try{
+ $result = civicrm_api3('phone', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function phone_delete_expectedresult(){
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using phone get API
+ * *
*/
function phone_get_example(){
$params = array(
- 'contact_id' => 8,
+ 'contact_id' => 7,
'phone' => '(123) 456-7890',
- 'version' => 3,
);
- $result = civicrm_api( 'phone','get',$params );
+try{
+ $result = civicrm_api3('phone', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function phone_get_expectedresult(){
'values' => array(
'1' => array(
'id' => '1',
- 'contact_id' => '8',
- 'location_type_id' => '11',
+ 'contact_id' => '7',
+ 'location_type_id' => '10',
'is_primary' => '1',
'is_billing' => 0,
'phone' => '(123) 456-7890',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- demonstrates high date filter
+/**
+ * Test Generated example of using pledge get API
+ * demonstrates high date filter *
*/
function pledge_get_example(){
$params = array(
- 'version' => 3,
- 'pledge_start_date_high' => '20130620090530',
+ 'pledge_start_date_high' => '20130726090416',
);
- $result = civicrm_api( 'pledge','get',$params );
+try{
+ $result = civicrm_api3('pledge', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function pledge_get_expectedresult(){
'display_name' => 'Mr. Anthony Anderson II',
'pledge_id' => '2',
'pledge_amount' => '100.00',
- 'pledge_create_date' => '2013-06-22 00:00:00',
+ 'pledge_create_date' => '2013-07-28 00:00:00',
'pledge_status' => 'Overdue',
'pledge_total_paid' => '',
'pledge_next_pay_date' => '2012-03-02 00:00:00',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using pledge create API
+ * *
*/
function pledge_create_example(){
$params = array(
'contact_id' => 11,
- 'pledge_create_date' => '20130622',
- 'start_date' => '20130622',
- 'scheduled_date' => '20130624',
+ 'pledge_create_date' => '20130728',
+ 'start_date' => '20130728',
+ 'scheduled_date' => '20130730',
'amount' => '100',
'pledge_status_id' => '2',
'pledge_financial_type_id' => '1',
'frequency_day' => 15,
'installments' => 5,
'sequential' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'pledge','create',$params );
+try{
+ $result = civicrm_api3('pledge', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function pledge_create_expectedresult(){
'frequency_interval' => '5',
'frequency_day' => '15',
'installments' => '5',
- 'start_date' => '20130622000000',
- 'create_date' => '20130622000000',
+ 'start_date' => '20130728000000',
+ 'create_date' => '20120130621222105',
'acknowledge_date' => '',
'modified_date' => '2012-11-14 16:02:35',
'cancel_date' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using pledge delete API
+ * *
*/
function pledge_delete_example(){
$params = array(
'id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'pledge','delete',$params );
+try{
+ $result = civicrm_api3('pledge', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function pledge_delete_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using pledge get API
+ * *
*/
function pledge_get_example(){
$params = array(
'pledge_id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'pledge','get',$params );
+try{
+ $result = civicrm_api3('pledge', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function pledge_get_expectedresult(){
'display_name' => 'Mr. Anthony Anderson II',
'pledge_id' => '1',
'pledge_amount' => '100.00',
- 'pledge_create_date' => '2013-06-22 00:00:00',
+ 'pledge_create_date' => '2013-07-28 00:00:00',
'pledge_status' => 'Pending',
'pledge_total_paid' => '',
- 'pledge_next_pay_date' => '2013-06-24 00:00:00',
+ 'pledge_next_pay_date' => '2013-07-30 00:00:00',
'pledge_next_pay_amount' => '20.00',
'pledge_outstanding_amount' => '',
'pledge_financial_type' => 'Donation',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using pledge_payment create API
+ * *
*/
function pledge_payment_create_example(){
$params = array(
'contact_id' => 1,
'pledge_id' => 1,
'contribution_id' => 1,
- 'version' => 3,
'status_id' => 1,
'actual_amount' => 20,
);
- $result = civicrm_api( 'pledge_payment','create',$params );
+try{
+ $result = civicrm_api3('pledge_payment', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function pledge_payment_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using pledge_payment delete API
+ * *
*/
function pledge_payment_delete_example(){
$params = array(
'id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'pledge_payment','delete',$params );
+try{
+ $result = civicrm_api3('pledge_payment', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function pledge_payment_delete_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using pledge_payment get API
+ * *
*/
function pledge_payment_get_example(){
-$params = array(
- 'version' => 3,
-);
+$params = array();
- $result = civicrm_api( 'pledge_payment','get',$params );
+try{
+ $result = civicrm_api3('pledge_payment', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function pledge_payment_get_expectedresult(){
'pledge_id' => '1',
'scheduled_amount' => '20.00',
'currency' => 'USD',
- 'scheduled_date' => '2013-06-22 00:00:00',
+ 'scheduled_date' => '2013-07-28 00:00:00',
'reminder_count' => 0,
'status_id' => '2',
),
'pledge_id' => '1',
'scheduled_amount' => '20.00',
'currency' => 'USD',
- 'scheduled_date' => '2018-06-22 00:00:00',
+ 'scheduled_date' => '2018-07-28 00:00:00',
'reminder_count' => 0,
'status_id' => '2',
),
'pledge_id' => '1',
'scheduled_amount' => '20.00',
'currency' => 'USD',
- 'scheduled_date' => '2023-06-22 00:00:00',
+ 'scheduled_date' => '2023-07-28 00:00:00',
'reminder_count' => 0,
'status_id' => '2',
),
'pledge_id' => '1',
'scheduled_amount' => '20.00',
'currency' => 'USD',
- 'scheduled_date' => '2028-06-22 00:00:00',
+ 'scheduled_date' => '2028-07-28 00:00:00',
'reminder_count' => 0,
'status_id' => '2',
),
'pledge_id' => '1',
'scheduled_amount' => '20.00',
'currency' => 'USD',
- 'scheduled_date' => '2033-06-22 00:00:00',
+ 'scheduled_date' => '2033-07-28 00:00:00',
'reminder_count' => 0,
'status_id' => '2',
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using pledge_payment update API
+ * *
*/
function pledge_payment_update_example(){
$params = array(
- 'pledge_id' => 1,
- 'contribution_id' => 1,
- 'version' => 3,
- 'status_id' => 2,
- 'actual_amount' => 20,
+ 'id' => 1,
+ 'status_id' => 1,
);
- $result = civicrm_api( 'pledge_payment','update',$params );
+try{
+ $result = civicrm_api3('pledge_payment', 'update', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function pledge_payment_update_expectedresult(){
'scheduled_amount' => '20.00',
'actual_amount' => '20.00',
'currency' => 'USD',
- 'scheduled_date' => '20130622000000',
+ 'scheduled_date' => '20130728000000',
'reminder_date' => '',
'reminder_count' => 0,
'status_id' => '1',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using price_field create API
+ * *
*/
function price_field_create_example(){
$params = array(
- 'version' => 3,
'price_set_id' => 3,
'name' => 'grassvariety',
'label' => 'Grass Variety',
'is_active' => 1,
);
- $result = civicrm_api( 'price_field','create',$params );
+try{
+ $result = civicrm_api3('price_field', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function price_field_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using price_field delete API
+ * *
*/
function price_field_delete_example(){
$params = array(
- 'version' => 3,
'id' => 4,
);
- $result = civicrm_api( 'price_field','delete',$params );
+try{
+ $result = civicrm_api3('price_field', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function price_field_delete_expectedresult(){
'values' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using price_field get API
+ * *
*/
function price_field_get_example(){
$params = array(
- 'version' => 3,
'name' => 'contribution_amount',
);
- $result = civicrm_api( 'price_field','get',$params );
+try{
+ $result = civicrm_api3('price_field', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function price_field_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using price_field_value create API
+ * *
*/
function price_field_value_create_example(){
$params = array(
- 'version' => 3,
'price_field_id' => 13,
'membership_type_id' => 5,
'name' => 'memType1',
'financial_type_id' => 2,
);
- $result = civicrm_api( 'price_field_value','create',$params );
+try{
+ $result = civicrm_api3('price_field_value', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function price_field_value_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using price_field_value delete API
+ * *
*/
function price_field_value_delete_example(){
$params = array(
- 'version' => 3,
'id' => 7,
);
- $result = civicrm_api( 'price_field_value','delete',$params );
+try{
+ $result = civicrm_api3('price_field_value', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function price_field_value_delete_expectedresult(){
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using price_field_value get API
+ * *
*/
function price_field_value_get_example(){
$params = array(
- 'version' => 3,
'name' => 'contribution_amount',
);
- $result = civicrm_api( 'price_field_value','get',$params );
+try{
+ $result = civicrm_api3('price_field_value', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function price_field_value_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using price_set create API
+ * *
*/
function price_set_create_example(){
$params = array(
- 'version' => 3,
'name' => 'default_goat_priceset',
'title' => 'Goat accessories',
'is_active' => 1,
'is_reserved' => 1,
);
- $result = civicrm_api( 'price_set','create',$params );
+try{
+ $result = civicrm_api3('price_set', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function price_set_create_expectedresult(){
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'id' => 3,
+ 'id' => 15,
'values' => array(
- '3' => array(
- 'id' => '3',
+ '15' => array(
+ 'id' => '15',
'domain_id' => '',
'name' => 'default_goat_priceset',
'title' => 'Goat accessories',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using price_set delete API
+ * *
*/
function price_set_delete_example(){
$params = array(
- 'version' => 3,
- 'id' => 5,
+ 'id' => 17,
);
- $result = civicrm_api( 'price_set','delete',$params );
+try{
+ $result = civicrm_api3('price_set', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function price_set_delete_expectedresult(){
'values' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using price_set get API
+ * *
*/
function price_set_get_example(){
$params = array(
- 'version' => 3,
'name' => 'default_contribution_amount',
);
- $result = civicrm_api( 'price_set','get',$params );
+try{
+ $result = civicrm_api3('price_set', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function price_set_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using price_set set API
+ * *
*/
function price_set_set_example(){
$params = array(
- 'version' => 3,
'entity_table' => 'civicrm_event',
'entity_id' => 1,
'name' => 'event price',
'extends' => 1,
);
- $result = civicrm_api( 'price_set','set',$params );
+try{
+ $result = civicrm_api3('price_set', 'set', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function price_set_set_expectedresult(){
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'id' => 4,
+ 'id' => 16,
'values' => array(
- '4' => array(
- 'id' => '4',
+ '16' => array(
+ 'id' => '16',
'domain_id' => '',
'name' => 'event price',
'title' => 'event price',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using profile apply API
+ * *
*/
function profile_apply_example(){
$params = array(
'profile_id' => 25,
'contact_id' => 1,
- 'version' => 3,
'first_name' => 'abc2',
'last_name' => 'xyz2',
'email-Primary' => 'abc2.xyz2@gmail.com',
'state_province-1' => '1000',
);
- $result = civicrm_api( 'profile','apply',$params );
+try{
+ $result = civicrm_api3('profile', 'apply', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function profile_apply_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using profile get API
+ * *
*/
function profile_get_example(){
$params = array(
'profile_id' => 25,
'contact_id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'profile','get',$params );
+try{
+ $result = civicrm_api3('profile', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function profile_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using profile set API
+ * *
*/
function profile_set_example(){
$params = array(
'profile_id' => 25,
'contact_id' => 1,
- 'version' => 3,
'first_name' => 'abc2',
'last_name' => 'xyz2',
'email-Primary' => 'abc2.xyz2@gmail.com',
'state_province-1' => '1000',
);
- $result = civicrm_api( 'profile','set',$params );
+try{
+ $result = civicrm_api3('profile', 'set', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function profile_set_expectedresult(){
'first_name' => 'abc2',
'middle_name' => '',
'last_name' => 'xyz2',
- 'prefix_id' => '',
- 'suffix_id' => '',
'email_greeting_id' => '1',
'email_greeting_custom' => '',
- 'email_greeting_display' => 'Dear',
+ 'email_greeting_display' => 'Dear abc1',
'postal_greeting_id' => '1',
'postal_greeting_custom' => '',
- 'postal_greeting_display' => 'Dear',
+ 'postal_greeting_display' => 'Dear abc1',
'addressee_id' => '1',
'addressee_custom' => '',
- 'addressee_display' => '',
+ 'addressee_display' => '{contact.individual_prefix} abc1 {contact.middle_name} xyz1 {contact.individual_suffix}',
'job_title' => '',
'gender_id' => '',
'birth_date' => '',
'organization_name' => '',
'sic_code' => '',
'user_unique_id' => '',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'modified_date' => '2012-11-14 16:02:35',
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- demonstrates use of BETWEEN filter
+/**
+ * Test Generated example of using relationship get API
+ * demonstrates use of BETWEEN filter *
*/
function relationship_get_example(){
$params = array(
'relationship_type_id' => array(
'BETWEEN' => array(
- '0' => 33,
- '1' => 35,
+ '0' => 32,
+ '1' => 34,
),
),
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'relationship','get',$params );
+try{
+ $result = civicrm_api3('relationship', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function relationship_get_expectedresult(){
'values' => array(
'2' => array(
'id' => '2',
- 'contact_id_a' => '66',
- 'contact_id_b' => '67',
- 'relationship_type_id' => '33',
+ 'contact_id_a' => '63',
+ 'contact_id_b' => '64',
+ 'relationship_type_id' => '32',
'start_date' => '2008-12-20',
'is_active' => '1',
'description' => '',
),
'3' => array(
'id' => '3',
- 'contact_id_a' => '66',
- 'contact_id_b' => '67',
- 'relationship_type_id' => '34',
+ 'contact_id_a' => '63',
+ 'contact_id_b' => '64',
+ 'relationship_type_id' => '33',
'start_date' => '2008-12-20',
'is_active' => '1',
'description' => '',
),
'4' => array(
'id' => '4',
- 'contact_id_a' => '66',
- 'contact_id_b' => '67',
- 'relationship_type_id' => '35',
+ 'contact_id_a' => '63',
+ 'contact_id_b' => '64',
+ 'relationship_type_id' => '34',
'start_date' => '2008-12-20',
'is_active' => '1',
'description' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- demonstrates use of IN filter
+/**
+ * Test Generated example of using relationship get API
+ * demonstrates use of IN filter *
*/
function relationship_get_example(){
$params = array(
'relationship_type_id' => array(
'IN' => array(
- '0' => 33,
- '1' => 34,
+ '0' => 32,
+ '1' => 33,
),
),
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'relationship','get',$params );
+try{
+ $result = civicrm_api3('relationship', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function relationship_get_expectedresult(){
'values' => array(
'2' => array(
'id' => '2',
- 'contact_id_a' => '66',
- 'contact_id_b' => '67',
- 'relationship_type_id' => '33',
+ 'contact_id_a' => '63',
+ 'contact_id_b' => '64',
+ 'relationship_type_id' => '32',
'start_date' => '2008-12-20',
'is_active' => '1',
'description' => '',
),
'3' => array(
'id' => '3',
- 'contact_id_a' => '66',
- 'contact_id_b' => '67',
- 'relationship_type_id' => '34',
+ 'contact_id_a' => '63',
+ 'contact_id_b' => '64',
+ 'relationship_type_id' => '33',
'start_date' => '2008-12-20',
'is_active' => '1',
'description' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- demonstrates use of Not BETWEEN filter
+/**
+ * Test Generated example of using relationship get API
+ * demonstrates use of Not BETWEEN filter *
*/
function relationship_get_example(){
$params = array(
- 'version' => 3,
'relationship_type_id' => array(
'NOT BETWEEN' => array(
- '0' => 33,
- '1' => 35,
+ '0' => 32,
+ '1' => 34,
),
),
- 'debug' => 0,
);
- $result = civicrm_api( 'relationship','get',$params );
+try{
+ $result = civicrm_api3('relationship', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function relationship_get_expectedresult(){
'values' => array(
'1' => array(
'id' => '1',
- 'contact_id_a' => '66',
- 'contact_id_b' => '67',
- 'relationship_type_id' => '32',
+ 'contact_id_a' => '63',
+ 'contact_id_b' => '64',
+ 'relationship_type_id' => '31',
'start_date' => '2008-12-20',
'is_active' => '1',
'description' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- demonstrates use of NOT IN filter
+/**
+ * Test Generated example of using relationship get API
+ * demonstrates use of NOT IN filter *
*/
function relationship_get_example(){
$params = array(
'relationship_type_id' => array(
'NOT IN' => array(
- '0' => 33,
- '1' => 34,
+ '0' => 32,
+ '1' => 33,
),
),
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'relationship','get',$params );
+try{
+ $result = civicrm_api3('relationship', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function relationship_get_expectedresult(){
'values' => array(
'1' => array(
'id' => '1',
- 'contact_id_a' => '66',
- 'contact_id_b' => '67',
- 'relationship_type_id' => '32',
+ 'contact_id_a' => '63',
+ 'contact_id_b' => '64',
+ 'relationship_type_id' => '31',
'start_date' => '2008-12-20',
'is_active' => '1',
'description' => '',
),
'4' => array(
'id' => '4',
- 'contact_id_a' => '66',
- 'contact_id_b' => '67',
- 'relationship_type_id' => '35',
+ 'contact_id_a' => '63',
+ 'contact_id_b' => '64',
+ 'relationship_type_id' => '34',
'start_date' => '2008-12-20',
'is_active' => '1',
'description' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- demonstrates is_current filter
+/**
+ * Test Generated example of using relationship get API
+ * demonstrates is_current filter *
*/
function relationship_get_example(){
$params = array(
'filters' => array(
'is_current' => 1,
),
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'relationship','get',$params );
+try{
+ $result = civicrm_api3('relationship', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function relationship_get_expectedresult(){
'values' => array(
'2' => array(
'id' => '2',
- 'contact_id_a' => '63',
- 'contact_id_b' => '64',
- 'relationship_type_id' => '31',
+ 'contact_id_a' => '60',
+ 'contact_id_b' => '61',
+ 'relationship_type_id' => '30',
'start_date' => '2008-12-20',
'is_active' => '1',
'description' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using relationship create API
+ * *
*/
function relationship_create_example(){
$params = array(
- 'contact_id_a' => 27,
- 'contact_id_b' => 28,
- 'relationship_type_id' => 19,
+ 'contact_id_a' => 24,
+ 'contact_id_b' => 25,
+ 'relationship_type_id' => 18,
'start_date' => '2010-10-30',
'end_date' => '2010-12-30',
'is_active' => 1,
'note' => 'note',
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'relationship','create',$params );
+try{
+ $result = civicrm_api3('relationship', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function relationship_create_expectedresult(){
'values' => array(
'1' => array(
'id' => '1',
- 'contact_id_a' => '27',
- 'contact_id_b' => '28',
- 'relationship_type_id' => '19',
+ 'contact_id_a' => '24',
+ 'contact_id_b' => '25',
+ 'relationship_type_id' => '18',
'start_date' => '20101030000000',
'end_date' => '20101230000000',
'is_active' => '1',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using relationship delete API
+ * *
*/
function relationship_delete_example(){
$params = array(
'id' => 1,
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'relationship','delete',$params );
+try{
+ $result = civicrm_api3('relationship', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function relationship_delete_expectedresult(){
'values' => 'Deleted relationship successfully',
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using relationship get API
+ * *
*/
function relationship_get_example(){
$params = array(
- 'version' => 3,
'id' => 1,
- 'debug' => 0,
);
- $result = civicrm_api( 'relationship','get',$params );
+try{
+ $result = civicrm_api3('relationship', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function relationship_get_expectedresult(){
'values' => array(
'1' => array(
'id' => '1',
- 'contact_id_a' => '36',
- 'contact_id_b' => '37',
- 'relationship_type_id' => '22',
+ 'contact_id_a' => '33',
+ 'contact_id_b' => '34',
+ 'relationship_type_id' => '21',
'start_date' => '2008-12-20',
'is_active' => '1',
'description' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using relationship_type create API
+ * *
*/
function relationship_type_create_example(){
$params = array(
'contact_type_b' => 'Organization',
'is_reserved' => 1,
'is_active' => 1,
- 'version' => 3,
'sequential' => 1,
);
- $result = civicrm_api( 'relationship_type','create',$params );
+try{
+ $result = civicrm_api3('relationship_type', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function relationship_type_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using relationship_type delete API
+ * *
*/
function relationship_type_delete_example(){
$params = array(
'id' => 1,
- 'version' => 3,
);
- $result = civicrm_api( 'relationship_type','delete',$params );
+try{
+ $result = civicrm_api3('relationship_type', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function relationship_type_delete_expectedresult(){
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'values' => 1,
+ 'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- shows setting a variable for all domains
+/**
+ * Test Generated example of using setting create API
+ * shows setting a variable for all domains *
*/
function setting_create_example(){
$params = array(
- 'version' => 3,
'domain_id' => 'all',
'uniq_email_per_site' => 1,
);
- $result = civicrm_api( 'setting','create',$params );
+try{
+ $result = civicrm_api3('setting', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function setting_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- shows setting a variable for a current domain
+/**
+ * Test Generated example of using setting create API
+ * shows setting a variable for a current domain *
*/
function setting_create_example(){
$params = array(
- 'version' => 3,
'uniq_email_per_site' => 1,
);
- $result = civicrm_api( 'setting','create',$params );
+try{
+ $result = civicrm_api3('setting', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function setting_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- shows setting a variable for specified domains
+/**
+ * Test Generated example of using setting create API
+ * shows setting a variable for specified domains *
*/
function setting_create_example(){
$params = array(
- 'version' => 3,
'domain_id' => array(
'0' => 1,
'1' => 3,
'uniq_email_per_site' => 0,
);
- $result = civicrm_api( 'setting','create',$params );
+try{
+ $result = civicrm_api3('setting', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function setting_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- shows getting a variable for all domains
+/**
+ * Test Generated example of using setting Get API
+ * shows getting a variable for all domains *
*/
function setting_get_example(){
$params = array(
- 'version' => 3,
'domain_id' => 'all',
'return' => 'uniq_email_per_site',
);
- $result = civicrm_api( 'setting','Get',$params );
+try{
+ $result = civicrm_api3('setting', 'Get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function setting_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- gets defaults setting a variable for a given domain - if no domain is set current is assumed
+/**
+ * Test Generated example of using setting getdefaults API
+ * gets defaults setting a variable for a given domain - if no domain is set current is assumed *
*/
function setting_getdefaults_example(){
$params = array(
- 'version' => 3,
'name' => 'address_format',
);
- $result = civicrm_api( 'setting','getdefaults',$params );
+try{
+ $result = civicrm_api3('setting', 'getdefaults', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function setting_getdefaults_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- shows getting a variable for a current domain
+/**
+ * Test Generated example of using setting get API
+ * shows getting a variable for a current domain *
*/
function setting_get_example(){
$params = array(
- 'version' => 3,
'return' => 'uniq_email_per_site',
);
- $result = civicrm_api( 'setting','get',$params );
+try{
+ $result = civicrm_api3('setting', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function setting_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- shows getting a variable for specified domains
+/**
+ * Test Generated example of using setting Get API
+ * shows getting a variable for specified domains *
*/
function setting_get_example(){
$params = array(
- 'version' => 3,
'domain_id' => array(
'0' => 1,
'1' => 2,
),
);
- $result = civicrm_api( 'setting','Get',$params );
+try{
+ $result = civicrm_api3('setting', 'Get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function setting_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using setting create API
+ * *
*/
function setting_create_example(){
$params = array(
- 'version' => 3,
'domain_id' => 2,
'uniq_email_per_site' => 1,
);
- $result = civicrm_api( 'setting','create',$params );
+try{
+ $result = civicrm_api3('setting', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function setting_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using setting get API
+ * *
*/
function setting_get_example(){
$params = array(
- 'version' => 3,
'domain_id' => 2,
'return' => 'uniq_email_per_site',
);
- $result = civicrm_api( 'setting','get',$params );
+try{
+ $result = civicrm_api3('setting', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function setting_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Demonstrates getvalue action - intended for runtime use as better caching than get
+/**
+ * Test Generated example of using setting getvalue API
+ * Demonstrates getvalue action - intended for runtime use as better caching than get *
*/
function setting_getvalue_example(){
$params = array(
- 'version' => 3,
'name' => 'petition_contacts',
'group' => 'Campaign Preferences',
);
- $result = civicrm_api( 'setting','getvalue',$params );
+try{
+ $result = civicrm_api3('setting', 'getvalue', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function setting_getvalue_expectedresult(){
$expectedResult = 'Petition Contacts';
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Demonstrate return from getfields - see subfolder for variants
+/**
+ * Test Generated example of using setting getfields API
+ * Demonstrate return from getfields - see subfolder for variants *
*/
function setting_getfields_example(){
-$params = array(
- 'version' => 3,
-);
+$params = array();
- $result = civicrm_api( 'setting','getfields',$params );
+try{
+ $result = civicrm_api3('setting', 'getfields', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function setting_getfields_expectedresult(){
$expectedResult = array(
'is_error' => 0,
'version' => 3,
- 'count' => 75,
+ 'count' => 78,
'values' => array(
'address_standardization_provider' => array(
'group_name' => 'Address Preferences',
'description' => 'If enabled, deleted contacts will be moved to trash (instead of being destroyed). Users with the proper permission are able to search for the deleted contacts and restore them (or delete permanently).',
'help_text' => '',
),
+ 'allowPermDeleteFinancial' => array(
+ 'group_name' => 'CiviCRM Preferences',
+ 'group' => 'core',
+ 'name' => 'allowPermDeleteFinancial',
+ 'type' => 'Boolean',
+ 'quick_form_type' => 'YesNo',
+ 'default' => '',
+ 'add' => '4.3',
+ 'title' => 'Contact Permanent Delete',
+ 'is_domain' => 1,
+ 'is_contact' => 0,
+ 'description' => 'Allow Permanent Delete for contacts who are linked to live financial transactions',
+ 'help_text' => '',
+ ),
'versionAlert' => array(
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
),
'default' => 7,
'add' => '4.3',
- 'title' => 'Dashboard cache timeout',
+ 'title' => 'Checksum Lifespan',
'is_domain' => 1,
'is_contact' => 0,
'description' => '',
'help_text' => 'By default, CiviCRM will generate front-facing pages using the home page at http://wp/ as its base. If you want to use a different template for CiviCRM pages, set the path here.',
),
'secondDegRelPermissions' => array(
- 'group_name' => 'CiviCRM Preferences',
- 'group' => 'core',
- 'name' => 'secondDegRelPermissions',
- 'prefetch' => 1,
- 'config_only'=> 1,
- 'type' => 'Boolean',
- 'quick_form_type' => 'YesNo',
- 'default' => 0,
- 'add' => '4.3',
- 'title' => 'Allow second-degree relationship permissions',
- 'is_domain' => 1,
- 'is_contact' => 0,
- 'description' => "If enabled, contacts with the permission to edit a related contact will inherit that contact's permission to edit other related contacts",
- 'help_text' => null,
- ),
+ 'group_name' => 'CiviCRM Preferences',
+ 'group' => 'core',
+ 'name' => 'secondDegRelPermissions',
+ 'prefetch' => 1,
+ 'config_only' => 1,
+ 'type' => 'Boolean',
+ 'quick_form_type' => 'YesNo',
+ 'default' => 0,
+ 'add' => '4.3',
+ 'title' => 'Allow second-degree relationship permissions',
+ 'is_domain' => 1,
+ 'is_contact' => 0,
+ 'description' => 'If enabled, contacts with the permission to edit a related contact will inherit that contact's permission to edit other related contacts',
+ 'help_text' => '',
+ ),
+ 'enable_components' => array(
+ 'group_name' => 'CiviCRM Preferences',
+ 'group' => 'core',
+ 'name' => 'enable_components',
+ 'type' => 'Array',
+ 'quick_form_type' => 'Element',
+ 'html_type' => 'advmultiselect',
+ 'html_attributes' => array(
+ 'size' => 5,
+ 'style' => 'width:150px',
+ 'class' => 'advmultiselect',
+ ),
+ 'default' => array(
+ '0' => 'CiviEvent',
+ '1' => 'CiviContribute',
+ '2' => 'CiviMember',
+ '3' => 'CiviMail',
+ '4' => 'CiviReport',
+ '5' => 'CiviPledge',
+ ),
+ 'add' => '4.4',
+ 'title' => 'Enable Components',
+ 'is_domain' => '1',
+ 'is_contact' => 0,
+ 'description' => '',
+ 'help_text' => '',
+ ),
'debug_enabled' => array(
'group_name' => 'Developer Preferences',
'group' => 'developer',
'title' => 'Enable Debugging',
'is_domain' => 1,
'is_contact' => 0,
- 'description' => 'Set this value to Yes if you want to use one of CiviCRM\'s debugging tools. This feature should NOT be enabled for production sites',
+ 'description' => 'Set this value to Yes if you want to use one of CiviCRM's debugging tools. This feature should NOT be enabled for production sites',
'prefetch' => 1,
'help_text' => 'Do not turn this on on production sites',
),
'is_contact' => 0,
'description' => 'Set this value to Yes if you want CiviCRM error/debugging messages to also appear in Drupal error logs',
'prefetch' => 1,
- 'help_text' => 'Set this value to Yes if you want CiviCRM error/debugging messages the appear in your CMS\' error log.
-In the case of Drupal, this will cause all CiviCRM error messages to appear in the watchdog (assuming you have Drupal\'s watchdog enabled)',
+ 'help_text' => 'Set this value to Yes if you want CiviCRM error/debugging messages the appear in your CMS' error log.
+In the case of Drupal, this will cause all CiviCRM error messages to appear in the watchdog (assuming you have Drupal's watchdog enabled)',
),
'backtrace' => array(
'group_name' => 'Developer Preferences',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Demonstrates reverting a parameter to default value
+/**
+ * Test Generated example of using setting revert API
+ * Demonstrates reverting a parameter to default value *
*/
function setting_revert_example(){
$params = array(
- 'version' => 3,
'name' => 'address_format',
);
- $result = civicrm_api( 'setting','revert',$params );
+try{
+ $result = civicrm_api3('setting', 'revert', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function setting_revert_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- demonstrates get + delete in the same call
+/**
+ * Test Generated example of using survey get API
+ * demonstrates get + delete in the same call *
*/
function survey_get_example(){
$params = array(
'title' => 'survey title',
'api.survey.delete' => 1,
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'survey','get',$params );
+try{
+ $result = civicrm_api3('survey', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function survey_get_expectedresult(){
'max_number_of_contacts' => '12',
'is_active' => '1',
'is_default' => 0,
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'bypass_confirm' => 0,
'api.survey.delete' => array(
'is_error' => 0,
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using survey create API
+ * *
*/
function survey_create_example(){
$params = array(
'activity_type_id' => '35',
'max_number_of_contacts' => 12,
'instructions' => 'Call people, ask for money',
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'survey','create',$params );
+try{
+ $result = civicrm_api3('survey', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function survey_create_expectedresult(){
'is_active' => '',
'is_default' => '',
'created_id' => '',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'last_modified_id' => '',
'last_modified_date' => '',
'result_id' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using survey delete API
+ * *
*/
function survey_delete_example(){
$params = array(
'id' => 1,
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'survey','delete',$params );
+try{
+ $result = civicrm_api3('survey', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function survey_delete_expectedresult(){
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using survey get API
+ * *
*/
function survey_get_example(){
$params = array(
'activity_type_id' => '35',
'max_number_of_contacts' => 12,
'instructions' => 'Call people, ask for money',
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'survey','get',$params );
+try{
+ $result = civicrm_api3('survey', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function survey_get_expectedresult(){
'max_number_of_contacts' => '12',
'is_active' => '1',
'is_default' => 0,
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'bypass_confirm' => 0,
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using survey_respondant get API
+ * *
*/
function survey_respondant_get_example(){
$params = array(
- 'version' => 3,
'sequential' => '1',
'survey_id' => 1,
);
- $result = civicrm_api( 'survey_respondant','get',$params );
+try{
+ $result = civicrm_api3('survey_respondant', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function survey_respondant_get_expectedresult(){
'values' => array(),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- Flush all system caches
+/**
+ * Test Generated example of using system flush API
+ * Flush all system caches *
*/
function system_flush_example(){
-$params = array(
- 'version' => 3,
-);
+$params = array();
- $result = civicrm_api( 'system','flush',$params );
+try{
+ $result = civicrm_api3('system', 'flush', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function system_flush_expectedresult(){
'values' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
- demonstrates use of Return as an array
+/**
+ * Test Generated example of using tag get API
+ * demonstrates use of Return as an array *
*/
function tag_get_example(){
$params = array(
- 'id' => 7,
- 'name' => 'New Tag325818',
- 'version' => 3,
+ 'id' => '8',
+ 'name' => 'New Tag3',
'return' => array(
'0' => 'name',
),
);
- $result = civicrm_api( 'tag','get',$params );
+try{
+ $result = civicrm_api3('tag', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function tag_get_expectedresult(){
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'id' => 7,
+ 'id' => 8,
'values' => array(
- '7' => array(
- 'id' => '7',
- 'name' => 'New Tag325818',
+ '8' => array(
+ 'id' => '8',
+ 'name' => 'New Tag3',
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using tag create API
+ * *
*/
function tag_create_example(){
$params = array(
- 'name' => 'New Tag3',
- 'description' => 'This is description for New Tag 02',
- 'version' => 3,
+ 'name' => 'Super Heros',
+ 'description' => 'Outside undie-wearers',
);
- $result = civicrm_api( 'tag','create',$params );
+try{
+ $result = civicrm_api3('tag', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function tag_create_expectedresult(){
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'id' => 8,
+ 'id' => 12,
'values' => array(
- '8' => array(
- 'id' => '8',
- 'name' => 'New Tag3',
- 'description' => 'This is description for New Tag 02',
+ '12' => array(
+ 'id' => '12',
+ 'name' => 'Super Heros',
+ 'description' => 'Outside undie-wearers',
'parent_id' => '',
'is_selectable' => '',
'is_reserved' => '',
'is_tagset' => '',
'used_for' => 'civicrm_contact',
'created_id' => '',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using tag delete API
+ * *
*/
function tag_delete_example(){
$params = array(
- 'id' => 11,
- 'version' => 3,
+ 'id' => '17',
);
- $result = civicrm_api( 'tag','delete',$params );
+try{
+ $result = civicrm_api3('tag', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function tag_delete_expectedresult(){
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using tag get API
+ * *
*/
function tag_get_example(){
$params = array(
- 'id' => 6,
- 'name' => 'New Tag320719',
- 'version' => 3,
+ 'id' => '7',
+ 'name' => 'New Tag3',
);
- $result = civicrm_api( 'tag','get',$params );
+try{
+ $result = civicrm_api3('tag', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function tag_get_expectedresult(){
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'id' => 6,
+ 'id' => 7,
'values' => array(
- '6' => array(
- 'id' => '6',
- 'name' => 'New Tag320719',
- 'description' => 'This is description for New Tag 30716',
+ '7' => array(
+ 'id' => '7',
+ 'name' => 'New Tag3',
+ 'description' => 'This is description for Our New Tag ',
'is_selectable' => '1',
'is_reserved' => 0,
'is_tagset' => 0,
'used_for' => 'civicrm_contact',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
--- /dev/null
+<?php
+/**
+ * Test Generated example of using tag getfields API
+ * demonstrate use of getfields to interogate api *
+ */
+function tag_getfields_example(){
+$params = array(
+ 'action' => 'create',
+);
+
+try{
+ $result = civicrm_api3('tag', 'getfields', $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
+ */
+function tag_getfields_expectedresult(){
+
+ $expectedResult = array(
+ 'is_error' => 0,
+ 'version' => 3,
+ 'count' => 10,
+ 'values' => array(
+ 'id' => array(
+ 'name' => 'id',
+ 'type' => 1,
+ 'required' => true,
+ 'api.aliases' => array(
+ '0' => 'tag',
+ ),
+ ),
+ 'name' => array(
+ 'name' => 'name',
+ 'type' => 2,
+ 'title' => 'Name',
+ 'required' => true,
+ 'maxlength' => 64,
+ 'size' => 30,
+ 'api.required' => 1,
+ ),
+ 'description' => array(
+ 'name' => 'description',
+ 'type' => 2,
+ 'title' => 'Description',
+ 'maxlength' => 255,
+ 'size' => 45,
+ ),
+ 'parent_id' => array(
+ 'name' => 'parent_id',
+ 'type' => 1,
+ 'default' => 'UL',
+ 'FKClassName' => 'CRM_Core_DAO_Tag',
+ ),
+ 'is_selectable' => array(
+ 'name' => 'is_selectable',
+ 'type' => 16,
+ ),
+ 'is_reserved' => array(
+ 'name' => 'is_reserved',
+ 'type' => 16,
+ ),
+ 'is_tagset' => array(
+ 'name' => 'is_tagset',
+ 'type' => 16,
+ ),
+ 'used_for' => array(
+ 'name' => 'used_for',
+ 'type' => 2,
+ 'title' => 'Used For',
+ 'maxlength' => 64,
+ 'size' => 30,
+ 'default' => 'UL',
+ 'api.default' => 'civicrm_contact',
+ ),
+ 'created_id' => array(
+ 'name' => 'created_id',
+ 'type' => 1,
+ 'FKClassName' => 'CRM_Contact_DAO_Contact',
+ ),
+ 'created_date' => array(
+ 'name' => 'created_date',
+ 'type' => 12,
+ 'title' => 'Tag Created Date',
+ ),
+ ),
+);
+
+ 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
+* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/TagTest.php
+*
+* You can see the outcome of the API tests at
+* http://tests.dev.civicrm.org/trunk/results-api_v3
+*
+* To Learn about the API read
+* http://book.civicrm.org/developer/current/techniques/api/
+*
+* and review the wiki at
+* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
+*
+* 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
+*/
\ No newline at end of file
<?php
-
-/*
-
+/**
+ * Test Generated example of using uf_field create API
+ * *
*/
function uf_field_create_example(){
$params = array(
'is_active' => 1,
'location_type_id' => 1,
'phone_type_id' => 1,
- 'version' => 3,
'uf_group_id' => 11,
);
- $result = civicrm_api( 'uf_field','create',$params );
+try{
+ $result = civicrm_api3('uf_field', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function uf_field_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using uf_field delete API
+ * *
*/
function uf_field_delete_example(){
$params = array(
'field_id' => 1,
- 'version' => 3,
- 'debug' => 0,
);
- $result = civicrm_api( 'uf_field','delete',$params );
+try{
+ $result = civicrm_api3('uf_field', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function uf_field_delete_expectedresult(){
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using uf_field get API
+ * *
*/
function uf_field_get_example(){
-$params = array(
- 'version' => 3,
- 'debug' => 0,
-);
+$params = array();
- $result = civicrm_api( 'uf_field','get',$params );
+try{
+ $result = civicrm_api3('uf_field', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function uf_field_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using uf_field replace API
+ * *
*/
function uf_field_replace_example(){
$params = array(
- 'version' => 3,
'uf_group_id' => 11,
'option.autoweight' => '',
'values' => array(
),
);
- $result = civicrm_api( 'uf_field','replace',$params );
+try{
+ $result = civicrm_api3('uf_field', 'replace', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function uf_field_replace_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using uf_group create API
+ * *
*/
function uf_group_create_example(){
$params = array(
'notify' => 'admin@example.org',
'post_URL' => 'http://example.org/post',
'title' => 'Test Group',
- 'version' => 3,
);
- $result = civicrm_api( 'uf_group','create',$params );
+try{
+ $result = civicrm_api3('uf_group', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function uf_group_create_expectedresult(){
'is_reserved' => '1',
'name' => 'Test_Group_12',
'created_id' => '69',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'is_proximity_search' => '',
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using uf_group delete API
+ * *
*/
function uf_group_delete_example(){
$params = array(
'notify' => 'admin@example.org',
'post_URL' => 'http://example.org/post',
'title' => 'Test Group',
- 'version' => 3,
);
- $result = civicrm_api( 'uf_group','delete',$params );
+try{
+ $result = civicrm_api3('uf_group', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function uf_group_delete_expectedresult(){
'values' => true,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using uf_group get API
+ * *
*/
function uf_group_get_example(){
$params = array(
'notify' => 'admin@example.org',
'post_URL' => 'http://example.org/post',
'title' => 'Test Group',
- 'version' => 3,
);
- $result = civicrm_api( 'uf_group','get',$params );
+try{
+ $result = civicrm_api3('uf_group', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function uf_group_get_expectedresult(){
'is_reserved' => '1',
'name' => 'Test_Group_12',
'created_id' => '69',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'is_proximity_search' => 0,
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using uf_join create API
+ * *
*/
function uf_join_create_example(){
$params = array(
'weight' => 1,
'uf_group_id' => 11,
'is_active' => 1,
- 'version' => 3,
'sequential' => 1,
);
- $result = civicrm_api( 'uf_join','create',$params );
+try{
+ $result = civicrm_api3('uf_join', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function uf_join_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using uf_join get API
+ * *
*/
function uf_join_get_example(){
$params = array(
'entity_table' => 'civicrm_contribution_page',
'entity_id' => 1,
- 'version' => 3,
'sequential' => 1,
);
- $result = civicrm_api( 'uf_join','get',$params );
+try{
+ $result = civicrm_api3('uf_join', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function uf_join_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using uf_match get API
+ * *
*/
function uf_match_get_example(){
$params = array(
'contact_id' => 69,
- 'version' => 3,
);
- $result = civicrm_api( 'uf_match','get',$params );
+try{
+ $result = civicrm_api3('uf_match', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function uf_match_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using website create API
+ * *
*/
function website_create_example(){
$params = array(
- 'version' => 3,
'contact_id' => 3,
'url' => 'website.com',
'website_type_id' => 1,
);
- $result = civicrm_api( 'website','create',$params );
+try{
+ $result = civicrm_api3('website', '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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function website_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using website delete API
+ * *
*/
function website_delete_example(){
$params = array(
- 'version' => 3,
'id' => 1,
);
- $result = civicrm_api( 'website','delete',$params );
+try{
+ $result = civicrm_api3('website', 'delete', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function website_delete_expectedresult(){
'values' => 1,
);
- return $expectedResult ;
+ return $expectedResult;
}
<?php
-
-/*
-
+/**
+ * Test Generated example of using website get API
+ * *
*/
function website_get_example(){
$params = array(
- 'version' => 3,
'contact_id' => 1,
'url' => 'website.com',
'website_type_id' => 1,
);
- $result = civicrm_api( 'website','get',$params );
+try{
+ $result = civicrm_api3('website', 'get', $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;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function website_get_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}
if ($bao !== FALSE) {
return civicrm_api3_create_success(TRUE);
}
- return civicrm_api3_create_error('Could not delete entity id ' . $params['id']);
+ throw new API_Exception('Could not delete entity id ' . $params['id']);
}
elseif (method_exists($bao_name, 'delete')) {
$dao = new $bao_name();
}
}
else {
- return civicrm_api3_create_error('Could not delete entity id ' . $params['id']);
+ throw new API_Exception('Could not delete entity id ' . $params['id']);
}
}
- return civicrm_api3_create_error('no delete method found');
+ throw new API_Exception('no delete method found');
}
/**
if(!empty($apiResult['trace'])){
$errorMessage .= "\n" . print_r($apiResult['trace'], TRUE);
}
-
$this->assertEquals(0, $apiResult['is_error'], $prefix . $errorMessage);
}
/**
* Function to create Tag
*
- * @return int tag_id of created tag
+ * @return array result of created tag
*/
- function tagCreate($params = NULL) {
- if ($params === NULL) {
- $params = array(
- 'name' => 'New Tag3' . rand(),
- 'description' => 'This is description for New Tag ' . rand(),
- 'domain_id' => '1',
- );
- }
-
- $result = $this->callAPISuccess('Tag', 'create', $params);
- return $result;
+ function tagCreate($params = array()) {
+ $defaults = array(
+ 'name' => 'New Tag3',
+ 'description' => 'This is description for Our New Tag ',
+ 'domain_id' => '1',
+ );
+ $params = array_merge($defaults, $params);
+ $result = $this->callAPISuccess('Tag', 'create', $params);
+ return $result['values'][$result['id']];
}
/**
}
$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));
$fieldsToChange = array(
'hash' => '67eac7789eaee00',
'modified_date' => '2012-11-14 16:02:35',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 05:52:14',
'create_date' => '20120130621222105',
);
- $keysToUnset = array('xdebug', 'undefined_fields');
+ $keysToUnset = array('xdebug', 'undefined_fields',);
foreach ($keysToUnset as $unwantedKey) {
if(isset($result[$unwantedKey])) {
unset($result[$unwantedKey]);
$financialAccount->delete();
}
}
+
+ /**
+ * Use $ids as an instruction to do test cleanup
+ */
+ function deleteFromIDSArray() {
+ foreach ($this->ids as $entity => $ids) {
+ foreach ($ids as $id) {
+ $this->callAPISuccess($entity, 'delete', array('id' => $id));
+ }
+ }
+ }
}
function CiviUnitTestCase_fatalErrorHandler($message) {
$params['custom_' . $ids['custom_field_id']] = "custom string";
$description = "/*this demonstrates setting a custom field through the API ";
$subfile = "CustomFieldCreate";
- $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
+ $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, $description);
$check = $this->callAPISuccess($this->_entity, 'get', array('return.custom_' . $ids['custom_field_id'] => 1, 'id' => $result['id']));
$this->assertEquals("custom string", $check['values'][$check['id']]['custom_' . $ids['custom_field_id']], ' in line ' . __LINE__);
'is_active' => 1,
);
- $customField = $this->callAPISuccess('custom_field', 'create', $params);
+ $customField = $this->callAPIAndDocument('custom_field', 'create', $params, __FUNCTION__, __FILE__);
$params['id'] = $customField['id'];
$customField = $this->callAPISuccess('custom_field', 'create', $params);
}
public function testCreateCustomValue() {
-
$params = array(
'custom_' . $this->ids['single']['custom_field_id'] => 'customString') + $this->params;
- $result = $this->callAPISuccess('custom_value', 'create', $params);
- $this->assertAPISuccess($result, 'In line ' . __LINE__);
+ $result = $this->callAPIAndDocument('custom_value', 'create', $params, __FUNCTION__, __FILE__);
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
$result = $this->callAPISuccess('custom_value', 'get', $params);
}
$result = $this->callAPISuccess('Contact', 'create', $params);
- $this->assertAPISuccess($result, __LINE__);
$contact_id = $result['id'];
$result = $this->callAPISuccess('Contact', 'create',
array(
parent::setUp();
$this->_individualID = $this->individualCreate(NULL);
- $this->_tag = $this->tagCreate(NULL);
+ $this->_tag = $this->tagCreate();
$this->_tagID = $this->_tag['id'];
$this->_householdID = $this->houseHoldCreate(NULL);
$this->_organizationID = $this->organizationCreate(NULL);
'tag_id' => $tagID,
);
- $individualEntity = $this->callAPISuccess('entity_tag', 'create', $params);
+ $individualEntity = $this->callAPIAndDocument('entity_tag', 'create', $params, __FUNCTION__, __FILE__);
$this->assertEquals($individualEntity['added'], 1);
$paramsEntity = array(
'id' => $result['id'], 'max_participants' => 150,
);
$this->callAPISuccess('Event', 'Create', $params);
- $updated = $this->callAPIAndDocument('Event', 'Get', $params, __FUNCTION__, __FILE__);
+ $updated = $this->callAPISuccess('Event', 'Get', $params, __FUNCTION__, __FILE__);
$this->assertEquals(150, $updated['values'][$result['id']]['max_participants']);
$this->assertEquals('Annual CiviCRM meet 2', $updated['values'][$result['id']]['title']);
$this->callAPISuccess($this->_entity, 'Delete', array('id' => $result['id']));
class api_v3_TagTest extends CiviUnitTestCase {
protected $_apiversion =3;
+ /**
+ * @ids array of values to be cleaned up in the tear down
+ */
+ protected $ids = array();
+ /**
+ * tag id
+ * @var integer
+ */
+ protected $tag = array();
+
+ protected $tagID;
public $_eNoticeCompliant = TRUE;
function setUp() {
parent::setUp();
+ $this->tag = $this->tagCreate();
+ $this->ids['tag'][] = $this->tagID = $this->tag['id'];
}
- function tearDown() {}
-
- ///////////////// civicrm_tag_get methods
-
- /**
- * Test civicrm_tag_get with wrong params type.
- */
- public function testGetWrongParamsType() {
- $params = 'is_string';
- $result = $this->callAPIFailure('tag', 'get', $params);
- $this->assertEquals('Input variable `params` is not an array', $result['error_message'], 'In line ' . __LINE__);
+ function tearDown() {
+ $this->deleteFromIDSArray();
}
+ ///////////////// civicrm_tag_get methods
/**
* Test civicrm_tag_get with wrong params.
*/
public function testGetWrongParams() {
$params = array('name' => 'Wrong Tag Name');
$result = $this->callAPISuccess('tag', 'get', $params);
- $this->assertEquals(0, $result['count'], 'In line ' . __LINE__);
+ $this->assertEquals(0, $result['count']);
}
/**
* Test civicrm_tag_get - success expected.
*/
public function testGet() {
- $tag = $this->tagCreate(NULL);
-
$params = array(
- 'id' => $tag['id'],
- 'name' => $tag['values'][$tag['id']]['name'],
+ 'id' => $this->tagID,
+ 'name' => $this->tag['name'],
);
$result = $this->callAPIAndDocument('tag', 'get', $params, __FUNCTION__, __FILE__);
- $this->assertEquals($tag['values'][$tag['id']]['description'], $result['values'][$tag['id']]['description'], 'In line ' . __LINE__);
- $this->assertEquals($tag['values'][$tag['id']]['name'], $result['values'][$tag['id']]['name'], 'In line ' . __LINE__);
+ $this->assertEquals($this->tag['description'], $result['values'][$this->tagID]['description'], 'In line ' . __LINE__);
+ $this->assertEquals($this->tag['name'], $result['values'][$this->tagID]['name']);
}
/**
public function testGetReturnArray() {
$description = "demonstrates use of Return as an array";
$subfile = "getReturnArray";
- $tag = $this->tagCreate(NULL);
$params = array(
- 'id' => $tag['id'],
- 'name' => $tag['values'][$tag['id']]['name'],
+ 'id' => $this->tagID,
+ 'name' => $this->tag['name'],
'return' => array('name'),
);
$result = $this->callAPIAndDocument('tag', 'get', $params, __FUNCTION__, __FILE__, $description, $subfile);
- $this->assertTrue(empty($result['values'][$tag['id']]['description']), 'In line ' . __LINE__);
- $this->assertEquals($tag['values'][$tag['id']]['name'], $result['values'][$tag['id']]['name'], 'In line ' . __LINE__);
+ $this->assertTrue(empty($result['values'][$this->tagID]['description']));
+ $this->assertEquals($this->tag['name'], $result['values'][$this->tagID]['name']);
}
///////////////// civicrm_tag_create methods
- /**
- * Test civicrm_tag_create with wrong params type.
- */
- function testCreateWrongParamsType() {
- $params = 'a string';
- $result = $this->callAPIFailure('tag', 'create', $params);
- $this->assertEquals('Input variable `params` is not an array', $result['error_message'], 'In line ' . __LINE__);
- }
-
/**
* Test civicrm_tag_create with empty params.
*/
*/
function testCreate() {
$params = array(
- 'name' => 'New Tag3',
- 'description' => 'This is description for New Tag 02',
+ 'name' => 'Super Heros',
+ 'description' => 'Outside undie-wearers',
);
-
$result = $this->callAPIAndDocument('tag', 'create', $params, __FUNCTION__, __FILE__);
$this->assertNotNull($result['id'], 'In line ' . __LINE__);
$params['used_for'] = 'civicrm_contact';
}
///////////////// civicrm_tag_delete methods
- /**
- * Test civicrm_tag_delete with wrong parameters type.
- */
- function testDeleteWrongParamsType() {
- $tag = 'is string';
- $result = $this->callAPIFailure('tag', 'delete', $tag);
- $this->assertEquals('Input variable `params` is not an array', $result['error_message'], 'In line ' . __LINE__);
- }
-
- /**
- * Test civicrm_tag_delete with empty parameters.
- */
- function testDeleteEmptyParams() {
- $result = $this->callAPIFailure('tag', 'delete', array(), 'Mandatory key(s) missing from params array: id');
- }
-
/**
* Test civicrm_tag_delete without tag id.
*/
* Test civicrm_tag_delete .
*/
function testTagDeleteOldSyntax() {
- $tagID = $this->tagCreate(NULL);
$params = array(
- 'tag_id' => $tagID['id'],
+ 'tag_id' => $this->tagID,
);
$result = $this->callAPISuccess('tag', 'delete', $params);
+ unset($this->ids['tag']);
}
/**
* Test civicrm_tag_delete = $params['id'] is correct
*/
function testTagDeleteCorrectSyntax() {
- $tagID = $this->tagCreate(NULL);
$params = array(
- 'id' => $tagID['id'],
+ 'id' => $this->tagID,
);
$result = $this->callAPIAndDocument('tag', 'delete', $params, __FUNCTION__, __FILE__);
+ unset($this->ids['tag']);
}
function testTagGetfields() {
*
* API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
-*/
\ No newline at end of file
+*/