3 * Test Generated example demonstrating the LocBlock.create API.
5 * Create entities and locBlock in 1 api call.
10 function loc_block_create_example() {
13 'location_type_id' => 1,
14 'email' => 'test2@loc.block',
17 'location_type_id' => 1,
18 'phone' => '987654321',
21 'location_type_id' => 1,
22 'phone' => '456-7890',
25 'location_type_id' => 1,
26 'street_address' => '987654321',
31 $result = civicrm_api3('LocBlock', 'create', $params);
33 catch (CiviCRM_API3_Exception
$e) {
35 $errorMessage = $e->getMessage();
36 $errorCode = $e->getErrorCode();
37 $errorData = $e->getExtraParams();
39 'error' => $errorMessage,
40 'error_code' => $errorCode,
41 'error_data' => $errorData,
49 * Function returns array of result expected from previous function.
54 function loc_block_create_expectedresult() {
56 $expectedResult = array(
65 'location_type_id' => '1',
68 'street_address' => '987654321',
69 'manual_geo_code' => 0,
74 'location_type_id' => '1',
75 'email' => 'test2@loc.block',
82 'signature_text' => '',
83 'signature_html' => '',
88 'location_type_id' => '1',
91 'mobile_provider_id' => '',
92 'phone' => '987654321',
94 'phone_numeric' => '',
95 'phone_type_id' => '',
100 'location_type_id' => '1',
103 'mobile_provider_id' => '',
104 'phone' => '456-7890',
106 'phone_numeric' => '',
107 'phone_type_id' => '',
114 'address_2_id' => '',
122 return $expectedResult;
126 * This example has been generated from the API test suite.
127 * The test that created it is called "testCreateLocBlockEntities"
128 * and can be found at:
129 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LocBlockTest.php
131 * You can see the outcome of the API tests at
132 * https://test.civicrm.org/job/CiviCRM-master-git/
134 * To Learn about the API read
135 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
137 * Browse the api on your own site with the api explorer
138 * http://MYSITE.ORG/path/to/civicrm/api
140 * Read more about testing here
141 * http://wiki.civicrm.org/confluence/display/CRM/Testing
143 * API Standards documentation:
144 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards