Merge pull request #1048 from eileenmcnaughton/master
[civicrm-core.git] / api / v3 / examples / OptionValue / SortOption.php
1 <?php
2
3 /*
4 demonstrates use of Sort param (available in many api functions). Also, getsingle
5 */
6 function option_value_getsingle_example(){
7 $params = array(
8 'option_group_id' => 1,
9 'version' => 3,
10 'options' => array(
11 'sort' => 'label DESC',
12 'limit' => 1,
13 ),
14 );
15
16 $result = civicrm_api( 'option_value','getsingle',$params );
17
18 return $result;
19 }
20
21 /*
22 * Function returns array of result expected from previous function
23 */
24 function option_value_getsingle_expectedresult(){
25
26 $expectedResult = array(
27 'id' => '4',
28 'option_group_id' => '1',
29 'label' => 'SMS',
30 'value' => '4',
31 'filter' => 0,
32 'weight' => '4',
33 'is_optgroup' => 0,
34 'is_reserved' => 0,
35 'is_active' => '1',
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 * testGetSingleValueOptionValueSort and can be found in
46 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/OptionValueTest.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 */