CRM-13072 further tweak on example formatter
[civicrm-core.git] / api / v3 / examples / CustomValue / formatFieldName.php
CommitLineData
6a488035
TO
1<?php
2
3/*
4 utilises field names
5 */
6function custom_value_get_example(){
53ca8fd7 7$params = array(
6a488035
TO
8 'id' => 2,
9 'version' => 3,
10 'entity_id' => 2,
11 'format.field_names' => 1,
12);
13
14 $result = civicrm_api( 'custom_value','get',$params );
15
16 return $result;
17}
18
19/*
20 * Function returns array of result expected from previous function
21 */
22function custom_value_get_expectedresult(){
23
53ca8fd7 24 $expectedResult = array(
6a488035
TO
25 'is_error' => 0,
26 'version' => 3,
27 'count' => 4,
53ca8fd7 28 'values' => array(
29 'mySingleField' => array(
6a488035
TO
30 'entity_id' => '2',
31 'latest' => 'value 1',
32 'id' => 'mySingleField',
33 '0' => 'value 1',
34 ),
53ca8fd7 35 'Cust_Field' => array(
6a488035
TO
36 'entity_id' => '2',
37 'latest' => 'coffee',
38 'id' => 'Cust_Field',
39 '1' => '',
40 '2' => 'coffee',
41 ),
53ca8fd7 42 'field_2' => array(
6a488035
TO
43 'entity_id' => '2',
44 'latest' => 'value 4',
45 'id' => 'field_2',
46 '1' => '',
47 '2' => 'value 4',
48 ),
53ca8fd7 49 'field_3' => array(
6a488035
TO
50 'entity_id' => '2',
51 'latest' => '',
52 'id' => 'field_3',
53 '1' => 'vegemite',
54 '2' => '',
55 ),
56 ),
57);
58
59 return $expectedResult ;
60}
61
62
63/*
64* This example has been generated from the API test suite. The test that created it is called
65*
66* testGetMultipleCustomValues and can be found in
67* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/CustomValueTest.php
68*
69* You can see the outcome of the API tests at
70* http://tests.dev.civicrm.org/trunk/results-api_v3
71*
72* To Learn about the API read
73* http://book.civicrm.org/developer/current/techniques/api/
74*
75* and review the wiki at
76* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
77*
78* Read more about testing here
79* http://wiki.civicrm.org/confluence/display/CRM/Testing
80*
81* API Standards documentation:
82* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
83*/