Merge pull request #265 from colemanw/del-fix
[civicrm-core.git] / api / v3 / examples / CustomValueGet.php
1 <?php
2
3 /*
4 /*this demonstrates the use of CustomValue get
5 */
6 function custom_value_get_example(){
7 $params = array(
8 'id' => 2,
9 'version' => 3,
10 'entity_id' => 2,
11 );
12
13 $result = civicrm_api( 'custom_value','get',$params );
14
15 return $result;
16 }
17
18 /*
19 * Function returns array of result expected from previous function
20 */
21 function custom_value_get_expectedresult(){
22
23 $expectedResult = array(
24 'is_error' => 0,
25 'version' => 3,
26 'count' => 7,
27 'values' => array(
28 '1' => array(
29 'entity_id' => '2',
30 'latest' => 'value 1',
31 'id' => '1',
32 '0' => 'value 1',
33 ),
34 '2' => array(
35 'entity_id' => '2',
36 'latest' => 'value 3',
37 'id' => '2',
38 '1' => 'value 2',
39 '2' => 'value 3',
40 ),
41 '3' => array(
42 'entity_id' => '2',
43 'latest' => '',
44 'id' => '3',
45 '1' => 'warm beer',
46 '2' => '',
47 ),
48 '4' => array(
49 'entity_id' => '2',
50 'latest' => '',
51 'id' => '4',
52 '1' => 'fl* w*',
53 '2' => '',
54 ),
55 '5' => array(
56 'entity_id' => '2',
57 'latest' => 'coffee',
58 'id' => '5',
59 '1' => '',
60 '2' => 'coffee',
61 ),
62 '6' => array(
63 'entity_id' => '2',
64 'latest' => 'value 4',
65 'id' => '6',
66 '1' => '',
67 '2' => 'value 4',
68 ),
69 '7' => array(
70 'entity_id' => '2',
71 'latest' => '',
72 'id' => '7',
73 '1' => 'vegemite',
74 '2' => '',
75 ),
76 ),
77 );
78
79 return $expectedResult ;
80 }
81
82
83 /*
84 * This example has been generated from the API test suite. The test that created it is called
85 *
86 * testGetMultipleCustomValues and can be found in
87 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/CustomValueTest.php
88 *
89 * You can see the outcome of the API tests at
90 * http://tests.dev.civicrm.org/trunk/results-api_v3
91 *
92 * To Learn about the API read
93 * http://book.civicrm.org/developer/current/techniques/api/
94 *
95 * and review the wiki at
96 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
97 *
98 * Read more about testing here
99 * http://wiki.civicrm.org/confluence/display/CRM/Testing
100 *
101 * API Standards documentation:
102 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
103 */