3 * Test Generated example of using phone create API
6 function phone_create_example(){
9 'location_type_id' => 6,
10 'phone' => '(123) 456-7890',
16 $result = civicrm_api3('phone', 'create', $params);
18 catch (CiviCRM_API3_Exception
$e) {
20 $errorMessage = $e->getMessage();
21 $errorCode = $e->getErrorCode();
22 $errorData = $e->getExtraParams();
23 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
30 * Function returns array of result expected from previous function
32 function phone_create_expectedresult(){
34 $expectedResult = array(
43 'location_type_id' => '6',
46 'mobile_provider_id' => '',
47 'phone' => '(123) 456-7890',
49 'phone_numeric' => '',
50 'phone_type_id' => '1',
55 return $expectedResult;
60 * This example has been generated from the API test suite. The test that created it is called
62 * testCreatePhone and can be found in
63 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/PhoneTest.php
65 * You can see the outcome of the API tests at
66 * http://tests.dev.civicrm.org/trunk/results-api_v3
68 * To Learn about the API read
69 * http://book.civicrm.org/developer/current/techniques/api/
71 * and review the wiki at
72 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
74 * Read more about testing here
75 * http://wiki.civicrm.org/confluence/display/CRM/Testing
77 * API Standards documentation:
78 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards