Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | ||
3 | /* | |
4 | Criteria delete by nesting a GET & a DELETE | |
5 | */ | |
6 | function participant_get_example(){ | |
7 | $params = array( | |
8 | 'version' => 3, | |
9 | 'contact_id' => 4, | |
10 | 'api.participant.delete' => 1, | |
11 | ); | |
12 | ||
13 | $result = civicrm_api( 'participant','Get',$params ); | |
14 | ||
15 | return $result; | |
16 | } | |
17 | ||
18 | /* | |
19 | * Function returns array of result expected from previous function | |
20 | */ | |
21 | function participant_get_expectedresult(){ | |
22 | ||
23 | $expectedResult = array( | |
24 | 'is_error' => 0, | |
25 | 'version' => 3, | |
26 | 'count' => 2, | |
27 | 'values' => array( | |
28 | '2' => array( | |
29 | 'contact_id' => '4', | |
30 | 'contact_type' => 'Individual', | |
31 | 'contact_sub_type' => '', | |
32 | 'sort_name' => 'Anderson, Anthony', | |
33 | 'display_name' => 'Mr. Anthony Anderson II', | |
34 | 'event_id' => '37', | |
35 | 'event_title' => 'Annual CiviCRM meet', | |
36 | 'event_start_date' => '2008-10-21 00:00:00', | |
37 | 'event_end_date' => '2008-10-23 00:00:00', | |
38 | 'participant_id' => '2', | |
39 | 'participant_fee_level' => '', | |
40 | 'participant_fee_amount' => '', | |
41 | 'participant_fee_currency' => '', | |
42 | 'event_type' => 'Conference', | |
43 | 'participant_status_id' => '2', | |
44 | 'participant_status' => 'Attended', | |
45 | 'participant_role_id' => '1', | |
46 | 'participant_register_date' => '2007-02-19 00:00:00', | |
47 | 'participant_source' => 'Wimbeldon', | |
48 | 'participant_note' => '', | |
49 | 'participant_is_pay_later' => 0, | |
50 | 'participant_is_test' => 0, | |
51 | 'participant_registered_by_id' => '', | |
52 | 'participant_discount_name' => '', | |
53 | 'participant_campaign_id' => '', | |
54 | 'id' => '2', | |
55 | 'api.participant.delete' => array( | |
56 | 'is_error' => 0, | |
57 | 'version' => 3, | |
58 | 'count' => 1, | |
59 | 'values' => 1, | |
60 | ), | |
61 | ), | |
62 | '3' => array( | |
63 | 'contact_id' => '4', | |
64 | 'contact_type' => 'Individual', | |
65 | 'contact_sub_type' => '', | |
66 | 'sort_name' => 'Anderson, Anthony', | |
67 | 'display_name' => 'Mr. Anthony Anderson II', | |
68 | 'event_id' => '37', | |
69 | 'event_title' => 'Annual CiviCRM meet', | |
70 | 'event_start_date' => '2008-10-21 00:00:00', | |
71 | 'event_end_date' => '2008-10-23 00:00:00', | |
72 | 'participant_id' => '3', | |
73 | 'participant_fee_level' => '', | |
74 | 'participant_fee_amount' => '', | |
75 | 'participant_fee_currency' => '', | |
76 | 'event_type' => 'Conference', | |
77 | 'participant_status_id' => '2', | |
78 | 'participant_status' => 'Attended', | |
79 | 'participant_role_id' => '1', | |
80 | 'participant_register_date' => '2007-02-19 00:00:00', | |
81 | 'participant_source' => 'Wimbeldon', | |
82 | 'participant_note' => '', | |
83 | 'participant_is_pay_later' => 0, | |
84 | 'participant_is_test' => 0, | |
85 | 'participant_registered_by_id' => '', | |
86 | 'participant_discount_name' => '', | |
87 | 'participant_campaign_id' => '', | |
88 | 'id' => '3', | |
89 | 'api.participant.delete' => array( | |
90 | 'is_error' => 0, | |
91 | 'version' => 3, | |
92 | 'count' => 1, | |
93 | 'values' => 1, | |
94 | ), | |
95 | ), | |
96 | ), | |
97 | ); | |
98 | ||
99 | return $expectedResult ; | |
100 | } | |
101 | ||
102 | ||
103 | /* | |
104 | * This example has been generated from the API test suite. The test that created it is called | |
105 | * | |
106 | * testNestedDelete and can be found in | |
107 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ParticipantTest.php | |
108 | * | |
109 | * You can see the outcome of the API tests at | |
110 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
111 | * | |
112 | * To Learn about the API read | |
113 | * http://book.civicrm.org/developer/current/techniques/api/ | |
114 | * | |
115 | * and review the wiki at | |
116 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
117 | * | |
118 | * Read more about testing here | |
119 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
120 | * | |
121 | * API Standards documentation: | |
122 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
123 | */ |