Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | ||
3 | /* | |
4 | gets defaults setting a variable for a given domain - if no domain is set current is assumed | |
5 | */ | |
6 | function setting_getdefaults_example(){ | |
53ca8fd7 | 7 | $params = array( |
6a488035 TO |
8 | 'version' => 3, |
9 | 'name' => 'address_format', | |
10 | ); | |
11 | ||
12 | $result = civicrm_api( 'setting','getdefaults',$params ); | |
13 | ||
14 | return $result; | |
15 | } | |
16 | ||
17 | /* | |
18 | * Function returns array of result expected from previous function | |
19 | */ | |
20 | function setting_getdefaults_expectedresult(){ | |
21 | ||
53ca8fd7 | 22 | $expectedResult = array( |
6a488035 TO |
23 | 'is_error' => 0, |
24 | 'version' => 3, | |
25 | 'count' => 1, | |
26 | 'id' => 1, | |
53ca8fd7 | 27 | 'values' => array( |
28 | '1' => array( | |
6a488035 TO |
29 | 'address_format' => '{contact.address_name} |
30 | {contact.street_address} | |
31 | {contact.supplemental_address_1} | |
32 | {contact.supplemental_address_2} | |
33 | {contact.city}{, }{contact.state_province}{ }{contact.postal_code} | |
34 | {contact.country}', | |
35 | ), | |
36 | ), | |
37 | ); | |
38 | ||
39 | return $expectedResult ; | |
40 | } | |
41 | ||
42 | ||
43 | /* | |
44 | * This example has been generated from the API test suite. The test that created it is called | |
45 | * | |
46 | * testGetDefaults and can be found in | |
47 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/SettingTest.php | |
48 | * | |
49 | * You can see the outcome of the API tests at | |
50 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
51 | * | |
52 | * To Learn about the API read | |
53 | * http://book.civicrm.org/developer/current/techniques/api/ | |
54 | * | |
55 | * and review the wiki at | |
56 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
57 | * | |
58 | * Read more about testing here | |
59 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
60 | * | |
61 | * API Standards documentation: | |
62 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
63 | */ |