3 * Test Generated example demonstrating the Setting.getdefaults API.
5 * Gets defaults setting a variable for a given domain - if no domain is set current is assumed.
10 function setting_getdefaults_example() {
12 'name' => 'address_format',
16 $result = civicrm_api3('Setting', 'getdefaults', $params);
18 catch (CiviCRM_API3_Exception
$e) {
20 $errorMessage = $e->getMessage();
21 $errorCode = $e->getErrorCode();
22 $errorData = $e->getExtraParams();
25 'error_message' => $errorMessage,
26 'error_code' => $errorCode,
27 'error_data' => $errorData,
35 * Function returns array of result expected from previous function.
40 function setting_getdefaults_expectedresult() {
49 'address_format' => '{contact.address_name}
50 {contact.street_address}
51 {contact.supplemental_address_1}
52 {contact.supplemental_address_2}
53 {contact.supplemental_address_3}
54 {contact.city}{, }{contact.state_province}{ }{contact.postal_code}
60 return $expectedResult;
64 * This example has been generated from the API test suite.
65 * The test that created it is called "testGetDefaults"
66 * and can be found at:
67 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php
69 * You can see the outcome of the API tests at
70 * https://test.civicrm.org/job/CiviCRM-Core-Matrix/
72 * To Learn about the API read
73 * https://docs.civicrm.org/dev/en/latest/api/
75 * Browse the API on your own site with the API Explorer. It is in the main
76 * CiviCRM menu, under: Support > Development > API Explorer.
78 * Read more about testing here
79 * https://docs.civicrm.org/dev/en/latest/testing/
81 * API Standards documentation:
82 * https://docs.civicrm.org/dev/en/latest/framework/api-architecture/