Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | ||
3 | /* | |
4 | ||
5 | */ | |
6 | function option_value_get_example(){ | |
7 | $params = array( | |
8 | 'option_group_id' => 1, | |
9 | 'version' => 3, | |
10 | ); | |
11 | ||
12 | $result = civicrm_api( 'option_value','get',$params ); | |
13 | ||
14 | return $result; | |
15 | } | |
16 | ||
17 | /* | |
18 | * Function returns array of result expected from previous function | |
19 | */ | |
20 | function option_value_get_expectedresult(){ | |
21 | ||
22 | $expectedResult = array( | |
23 | 'is_error' => 0, | |
24 | 'version' => 3, | |
25 | 'count' => 5, | |
26 | 'values' => array( | |
27 | '1' => array( | |
28 | 'id' => '1', | |
29 | 'option_group_id' => '1', | |
30 | 'label' => 'Phone', | |
31 | 'value' => '1', | |
32 | 'filter' => 0, | |
33 | 'weight' => '1', | |
34 | 'is_optgroup' => 0, | |
35 | 'is_reserved' => 0, | |
36 | 'is_active' => '1', | |
37 | ), | |
38 | '2' => array( | |
39 | 'id' => '2', | |
40 | 'option_group_id' => '1', | |
41 | 'label' => 'Email', | |
42 | 'value' => '2', | |
43 | 'filter' => 0, | |
44 | 'weight' => '2', | |
45 | 'is_optgroup' => 0, | |
46 | 'is_reserved' => 0, | |
47 | 'is_active' => '1', | |
48 | ), | |
49 | '3' => array( | |
50 | 'id' => '3', | |
51 | 'option_group_id' => '1', | |
52 | 'label' => 'Postal Mail', | |
53 | 'value' => '3', | |
54 | 'filter' => 0, | |
55 | 'weight' => '3', | |
56 | 'is_optgroup' => 0, | |
57 | 'is_reserved' => 0, | |
58 | 'is_active' => '1', | |
59 | ), | |
60 | '4' => array( | |
61 | 'id' => '4', | |
62 | 'option_group_id' => '1', | |
63 | 'label' => 'SMS', | |
64 | 'value' => '4', | |
65 | 'filter' => 0, | |
66 | 'weight' => '4', | |
67 | 'is_optgroup' => 0, | |
68 | 'is_reserved' => 0, | |
69 | 'is_active' => '1', | |
70 | ), | |
71 | '5' => array( | |
72 | 'id' => '5', | |
73 | 'option_group_id' => '1', | |
74 | 'label' => 'Fax', | |
75 | 'value' => '5', | |
76 | 'filter' => 0, | |
77 | 'weight' => '5', | |
78 | 'is_optgroup' => 0, | |
79 | 'is_reserved' => 0, | |
80 | 'is_active' => '1', | |
81 | ), | |
82 | ), | |
83 | ); | |
84 | ||
85 | return $expectedResult ; | |
86 | } | |
87 | ||
88 | ||
89 | /* | |
90 | * This example has been generated from the API test suite. The test that created it is called | |
91 | * | |
92 | * testGetOptionGroup and can be found in | |
93 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/OptionValueTest.php | |
94 | * | |
95 | * You can see the outcome of the API tests at | |
96 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
97 | * | |
98 | * To Learn about the API read | |
99 | * http://book.civicrm.org/developer/current/techniques/api/ | |
100 | * | |
101 | * and review the wiki at | |
102 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
103 | * | |
104 | * Read more about testing here | |
105 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
106 | * | |
107 | * API Standards documentation: | |
108 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
109 | */ |