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