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