Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | ||
3 | /* | |
4 | ||
5 | */ | |
6 | function option_group_create_example(){ | |
7 | $params = array( | |
8 | 'version' => 3, | |
9 | 'sequential' => 1, | |
10 | 'name' => 'civicrm_event.amount.560', | |
11 | 'is_reserved' => 1, | |
12 | 'is_active' => 1, | |
13 | 'api.OptionValue.create' => array( | |
14 | 'label' => 'workshop', | |
15 | 'value' => 35, | |
16 | 'is_default' => 1, | |
17 | 'is_active' => 1, | |
18 | 'format.only_id' => 1, | |
19 | ), | |
20 | ); | |
21 | ||
22 | $result = civicrm_api( 'option_group','create',$params ); | |
23 | ||
24 | return $result; | |
25 | } | |
26 | ||
27 | /* | |
28 | * Function returns array of result expected from previous function | |
29 | */ | |
30 | function option_group_create_expectedresult(){ | |
31 | ||
32 | $expectedResult = array( | |
33 | 'is_error' => 0, | |
34 | 'version' => 3, | |
35 | 'count' => 1, | |
36 | 'id' => 86, | |
37 | 'values' => array( | |
38 | '0' => array( | |
39 | 'id' => '86', | |
40 | 'name' => 'civicrm_event.amount.560', | |
41 | 'title' => '', | |
42 | 'description' => '', | |
43 | 'is_reserved' => '1', | |
44 | 'is_active' => '1', | |
45 | 'api.OptionValue.create' => 723, | |
46 | ), | |
47 | ), | |
48 | ); | |
49 | ||
50 | return $expectedResult ; | |
51 | } | |
52 | ||
53 | ||
54 | /* | |
55 | * This example has been generated from the API test suite. The test that created it is called | |
56 | * | |
57 | * testGetOptionCreateSuccess and can be found in | |
58 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/OptionGroupTest.php | |
59 | * | |
60 | * You can see the outcome of the API tests at | |
61 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
62 | * | |
63 | * To Learn about the API read | |
64 | * http://book.civicrm.org/developer/current/techniques/api/ | |
65 | * | |
66 | * and review the wiki at | |
67 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
68 | * | |
69 | * Read more about testing here | |
70 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
71 | * | |
72 | * API Standards documentation: | |
73 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
74 | */ |