Commit | Line | Data |
---|---|---|
50fb255d | 1 | <?php |
50fb255d | 2 | /** |
3 | * Test Generated example of using tax_contribution_page delete API. | |
4 | * | |
50fb255d | 5 | * @return array |
6 | * API result array | |
7 | */ | |
8 | function tax_contribution_page_delete_example() { | |
cf8f0fff | 9 | $params = [ |
50fb255d | 10 | 'id' => 1, |
cf8f0fff | 11 | ]; |
50fb255d | 12 | |
13 | try{ | |
14 | $result = civicrm_api3('tax_contribution_page', 'delete', $params); | |
15 | } | |
16 | catch (CiviCRM_API3_Exception $e) { | |
17 | // Handle error here. | |
18 | $errorMessage = $e->getMessage(); | |
19 | $errorCode = $e->getErrorCode(); | |
20 | $errorData = $e->getExtraParams(); | |
cf8f0fff | 21 | return [ |
50fb255d | 22 | 'error' => $errorMessage, |
23 | 'error_code' => $errorCode, | |
24 | 'error_data' => $errorData, | |
cf8f0fff | 25 | ]; |
50fb255d | 26 | } |
27 | ||
28 | return $result; | |
29 | } | |
30 | ||
31 | /** | |
32 | * Function returns array of result expected from previous function. | |
33 | * | |
34 | * @return array | |
35 | * API result array | |
36 | */ | |
37 | function tax_contribution_page_delete_expectedresult() { | |
38 | ||
cf8f0fff | 39 | $expectedResult = [ |
50fb255d | 40 | 'is_error' => 0, |
41 | 'version' => 3, | |
42 | 'count' => 1, | |
43 | 'id' => 1, | |
cf8f0fff | 44 | 'values' => [ |
50fb255d | 45 | '1' => 1, |
cf8f0fff CW |
46 | ], |
47 | ]; | |
50fb255d | 48 | |
49 | return $expectedResult; | |
50 | } | |
51 | ||
52 | /** | |
53 | * This example has been generated from the API test suite. | |
54 | * The test that created it is called | |
55 | * testDeleteContribution | |
56 | * and can be found in | |
57 | * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TaxContributionPageTest.php | |
58 | * | |
59 | * You can see the outcome of the API tests at | |
60 | * https://test.civicrm.org/job/CiviCRM-master-git/ | |
61 | * | |
62 | * To Learn about the API read | |
63 | * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API | |
64 | * | |
65 | * Browse the api on your own site with the api explorer | |
41d4d31f | 66 | * http://MYSITE.ORG/path/to/civicrm/api |
50fb255d | 67 | * |
68 | * Read more about testing here | |
69 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
70 | * | |
71 | * API Standards documentation: | |
72 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
73 | */ |