Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | ||
3 | /* | |
4 | ||
5 | */ | |
6 | function membership_create_example(){ | |
7 | $params = array( | |
8 | 'contact_id' => 27, | |
9 | 'membership_type_id' => 24, | |
10 | 'join_date' => '2009-01-21', | |
11 | 'start_date' => '2009-01-21', | |
12 | 'end_date' => '2009-12-21', | |
13 | 'source' => 'Payment', | |
14 | 'is_override' => 1, | |
15 | 'status_id' => 30, | |
16 | 'version' => 3, | |
17 | 'custom_2' => 'custom string', | |
18 | ); | |
19 | ||
20 | $result = civicrm_api( 'membership','create',$params ); | |
21 | ||
22 | return $result; | |
23 | } | |
24 | ||
25 | /* | |
26 | * Function returns array of result expected from previous function | |
27 | */ | |
28 | function membership_create_expectedresult(){ | |
29 | ||
30 | $expectedResult = array( | |
31 | 'is_error' => 0, | |
32 | 'version' => 3, | |
33 | 'count' => 1, | |
34 | 'id' => 1, | |
35 | 'values' => array( | |
36 | '1' => array( | |
37 | 'id' => '1', | |
38 | 'contact_id' => '27', | |
39 | 'membership_type_id' => '24', | |
40 | 'join_date' => '20090121000000', | |
41 | 'start_date' => '20090121000000', | |
42 | 'end_date' => '20091221000000', | |
43 | 'source' => 'Payment', | |
44 | 'status_id' => '30', | |
45 | 'is_override' => '1', | |
46 | 'owner_membership_id' => '', | |
47 | 'max_related' => '', | |
48 | 'is_test' => '', | |
49 | 'is_pay_later' => '', | |
50 | 'contribution_recur_id' => '', | |
51 | 'campaign_id' => '', | |
52 | ), | |
53 | ), | |
54 | ); | |
55 | ||
56 | return $expectedResult ; | |
57 | } | |
58 | ||
59 | ||
60 | /* | |
61 | * This example has been generated from the API test suite. The test that created it is called | |
62 | * | |
63 | * testCreateWithCustom and can be found in | |
64 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/MembershipTest.php | |
65 | * | |
66 | * You can see the outcome of the API tests at | |
67 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
68 | * | |
69 | * To Learn about the API read | |
70 | * http://book.civicrm.org/developer/current/techniques/api/ | |
71 | * | |
72 | * and review the wiki at | |
73 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
74 | * | |
75 | * Read more about testing here | |
76 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
77 | * | |
78 | * API Standards documentation: | |
79 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
80 | */ |