Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | ||
3 | /* | |
4 | ||
5 | */ | |
6 | function custom_group_create_example(){ | |
7 | $params = array( | |
8 | 'title' => 'Test_Group_1', | |
9 | 'name' => 'test_group_1', | |
10 | 'extends' => array( | |
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 | ||
32 | $expectedResult = array( | |
33 | 'is_error' => 0, | |
34 | 'version' => 3, | |
35 | 'count' => 1, | |
36 | 'id' => 1, | |
37 | 'values' => array( | |
38 | '1' => array( | |
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' => '', | |
57 | 'created_date' => '', | |
58 | ), | |
59 | ), | |
60 | ); | |
61 | ||
62 | return $expectedResult ; | |
63 | } | |
64 | ||
65 | ||
66 | /* | |
67 | * This example has been generated from the API test suite. The test that created it is called | |
68 | * | |
69 | * testCustomGroupCreate and can be found in | |
70 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/CustomGroupTest.php | |
71 | * | |
72 | * You can see the outcome of the API tests at | |
73 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
74 | * | |
75 | * To Learn about the API read | |
76 | * http://book.civicrm.org/developer/current/techniques/api/ | |
77 | * | |
78 | * and review the wiki at | |
79 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
80 | * | |
81 | * Read more about testing here | |
82 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
83 | * | |
84 | * API Standards documentation: | |
85 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
86 | */ |