Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | ||
3 | /* | |
4 | ||
5 | */ | |
6 | function membership_type_create_example(){ | |
7 | $params = array( | |
8 | 'name' => '40+ Membership', | |
9 | 'description' => 'people above 40 are given health instructions', | |
10 | 'member_of_contact_id' => 1, | |
11 | 'financial_type_id' => 1, | |
12 | 'domain_id' => '1', | |
13 | 'minimum_fee' => '200', | |
14 | 'duration_unit' => 'month', | |
15 | 'duration_interval' => '10', | |
16 | 'period_type' => 'rolling', | |
17 | 'visibility' => 'public', | |
18 | 'version' => 3, | |
19 | ); | |
20 | ||
21 | $result = civicrm_api( 'membership_type','create',$params ); | |
22 | ||
23 | return $result; | |
24 | } | |
25 | ||
26 | /* | |
27 | * Function returns array of result expected from previous function | |
28 | */ | |
29 | function membership_type_create_expectedresult(){ | |
30 | ||
31 | $expectedResult = array( | |
32 | 'is_error' => 0, | |
33 | 'version' => 3, | |
34 | 'count' => 1, | |
35 | 'id' => 2, | |
36 | 'values' => array( | |
37 | '2' => array( | |
38 | 'id' => '2', | |
39 | 'domain_id' => '1', | |
40 | 'name' => '40+ Membership', | |
41 | 'description' => 'people above 40 are given health instructions', | |
42 | 'member_of_contact_id' => '1', | |
43 | 'financial_type_id' => '1', | |
44 | 'minimum_fee' => '200', | |
45 | 'duration_unit' => 'month', | |
46 | 'duration_interval' => '10', | |
47 | 'period_type' => 'rolling', | |
48 | 'fixed_period_start_day' => '', | |
49 | 'fixed_period_rollover_day' => '', | |
50 | 'relationship_type_id' => '', | |
51 | 'relationship_direction' => '', | |
52 | 'max_related' => '', | |
53 | 'visibility' => 'public', | |
54 | 'weight' => '', | |
55 | 'receipt_text_signup' => '', | |
56 | 'receipt_text_renewal' => '', | |
57 | 'auto_renew' => '', | |
58 | 'is_active' => '', | |
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 | * testCreate and can be found in | |
71 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/MembershipTypeTest.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 | */ |