Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | ||
3 | /* | |
4 | ||
5 | */ | |
6 | function custom_group_create_example(){ | |
53ca8fd7 | 7 | $params = array( |
6a488035 TO |
8 | 'title' => 'Test_Group_1', |
9 | 'name' => 'test_group_1', | |
53ca8fd7 | 10 | 'extends' => array( |
6a488035 TO |
11 | '0' => 'Individual', |
12 | ), | |
13 | 'weight' => 4, | |
14 | 'collapse_display' => 1, | |
15 | 'style' => 'Inline', | |
16 | 'help_pre' => 'This is Pre Help For Test Group 1', | |
17 | 'help_post' => 'This is Post Help For Test Group 1', | |
18 | 'is_active' => 1, | |
19 | 'version' => 3, | |
20 | ); | |
21 | ||
22 | $result = civicrm_api( 'custom_group','create',$params ); | |
23 | ||
24 | return $result; | |
25 | } | |
26 | ||
27 | /* | |
28 | * Function returns array of result expected from previous function | |
29 | */ | |
30 | function custom_group_create_expectedresult(){ | |
31 | ||
53ca8fd7 | 32 | $expectedResult = array( |
6a488035 TO |
33 | 'is_error' => 0, |
34 | 'version' => 3, | |
35 | 'count' => 1, | |
36 | 'id' => 1, | |
53ca8fd7 | 37 | 'values' => array( |
38 | '1' => array( | |
6a488035 TO |
39 | 'id' => '1', |
40 | 'name' => 'test_group_1', | |
41 | 'title' => 'Test_Group_1', | |
42 | 'extends' => 'Individual', | |
43 | 'extends_entity_column_id' => 'null', | |
44 | 'extends_entity_column_value' => 'null', | |
45 | 'style' => 'Inline', | |
46 | 'collapse_display' => '1', | |
47 | 'help_pre' => 'This is Pre Help For Test Group 1', | |
48 | 'help_post' => 'This is Post Help For Test Group 1', | |
49 | 'weight' => '2', | |
50 | 'is_active' => '1', | |
51 | 'table_name' => 'civicrm_value_test_group_1_1', | |
52 | 'is_multiple' => '', | |
53 | 'min_multiple' => '', | |
54 | 'max_multiple' => 'null', | |
55 | 'collapse_adv_display' => '', | |
56 | 'created_id' => '', | |
53ca8fd7 | 57 | 'created_date' => '20120130621222105', |
58 | 'is_reserved' => '', | |
6a488035 TO |
59 | ), |
60 | ), | |
61 | ); | |
62 | ||
63 | return $expectedResult ; | |
64 | } | |
65 | ||
66 | ||
67 | /* | |
68 | * This example has been generated from the API test suite. The test that created it is called | |
69 | * | |
70 | * testCustomGroupCreate and can be found in | |
71 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/CustomGroupTest.php | |
72 | * | |
73 | * You can see the outcome of the API tests at | |
74 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
75 | * | |
76 | * To Learn about the API read | |
77 | * http://book.civicrm.org/developer/current/techniques/api/ | |
78 | * | |
79 | * and review the wiki at | |
80 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
81 | * | |
82 | * Read more about testing here | |
83 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
84 | * | |
85 | * API Standards documentation: | |
86 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
87 | */ |