6bd0f386de0fa040e591dd1b447249e97794ae6b
3 * Test Generated example demonstrating the Pledge.create API.
8 function pledge_create_example() {
11 'pledge_create_date' => '20150222',
12 'start_date' => '20150222',
13 'scheduled_date' => '20150224',
15 'pledge_status_id' => '2',
16 'pledge_financial_type_id' => '1',
17 'pledge_original_installment_amount' => 20,
18 'frequency_interval' => 5,
19 'frequency_unit' => 'year',
20 'frequency_day' => 15,
26 $result = civicrm_api3('Pledge', 'create', $params);
28 catch (CiviCRM_API3_Exception
$e) {
30 $errorMessage = $e->getMessage();
31 $errorCode = $e->getErrorCode();
32 $errorData = $e->getExtraParams();
34 'error' => $errorMessage,
35 'error_code' => $errorCode,
36 'error_data' => $errorData,
44 * Function returns array of result expected from previous function.
49 function pledge_create_expectedresult() {
51 $expectedResult = array(
60 'financial_type_id' => '1',
61 'contribution_page_id' => '',
63 'original_installment_amount' => '20',
65 'frequency_unit' => 'year',
66 'frequency_interval' => '5',
67 'frequency_day' => '15',
68 'installments' => '5',
69 'start_date' => '2013-07-29 00:00:00',
70 'create_date' => '20120130621222105',
71 'acknowledge_date' => '',
72 'modified_date' => '',
75 'max_reminders' => '',
76 'initial_reminder_day' => '',
77 'additional_reminder_day' => '',
85 return $expectedResult;
89 * This example has been generated from the API test suite.
90 * The test that created it is called "testCreatePledge"
91 * and can be found at:
92 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php
94 * You can see the outcome of the API tests at
95 * https://test.civicrm.org/job/CiviCRM-master-git/
97 * To Learn about the API read
98 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
100 * Browse the api on your own site with the api explorer
101 * http://MYSITE.ORG/path/to/civicrm/api
103 * Read more about testing here
104 * http://wiki.civicrm.org/confluence/display/CRM/Testing
106 * API Standards documentation:
107 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards