Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
50fb255d | 2 | /** |
a828d7b8 | 3 | * Test Generated example demonstrating the PledgePayment.get API. |
50fb255d | 4 | * |
50fb255d | 5 | * @return array |
6 | * API result array | |
7 | */ | |
8 | function pledge_payment_get_example() { | |
9 | $params = array(); | |
6a488035 | 10 | |
50fb255d | 11 | try{ |
a828d7b8 | 12 | $result = civicrm_api3('PledgePayment', 'get', $params); |
50fb255d | 13 | } |
14 | catch (CiviCRM_API3_Exception $e) { | |
15 | // Handle error here. | |
16 | $errorMessage = $e->getMessage(); | |
17 | $errorCode = $e->getErrorCode(); | |
18 | $errorData = $e->getExtraParams(); | |
19 | return array( | |
20 | 'error' => $errorMessage, | |
21 | 'error_code' => $errorCode, | |
22 | 'error_data' => $errorData, | |
23 | ); | |
24 | } | |
25 | ||
26 | return $result; | |
6a488035 TO |
27 | } |
28 | ||
fb32de45 | 29 | /** |
50fb255d | 30 | * Function returns array of result expected from previous function. |
31 | * | |
32 | * @return array | |
33 | * API result array | |
6a488035 | 34 | */ |
50fb255d | 35 | function pledge_payment_get_expectedresult() { |
6a488035 | 36 | |
53ca8fd7 | 37 | $expectedResult = array( |
50fb255d | 38 | 'is_error' => 0, |
39 | 'version' => 3, | |
40 | 'count' => 5, | |
41 | 'values' => array( | |
53ca8fd7 | 42 | '1' => array( |
50fb255d | 43 | 'id' => '1', |
44 | 'pledge_id' => '1', | |
45 | 'scheduled_amount' => '20.00', | |
46 | 'currency' => 'USD', | |
47 | 'scheduled_date' => '20130728085413', | |
48 | 'reminder_count' => 0, | |
49 | 'status_id' => '2', | |
50 | ), | |
53ca8fd7 | 51 | '2' => array( |
50fb255d | 52 | 'id' => '2', |
53 | 'pledge_id' => '1', | |
54 | 'scheduled_amount' => '20.00', | |
55 | 'currency' => 'USD', | |
56 | 'scheduled_date' => '20130728085413', | |
57 | 'reminder_count' => 0, | |
58 | 'status_id' => '2', | |
59 | ), | |
53ca8fd7 | 60 | '3' => array( |
50fb255d | 61 | 'id' => '3', |
62 | 'pledge_id' => '1', | |
63 | 'scheduled_amount' => '20.00', | |
64 | 'currency' => 'USD', | |
65 | 'scheduled_date' => '20130728085413', | |
66 | 'reminder_count' => 0, | |
67 | 'status_id' => '2', | |
68 | ), | |
53ca8fd7 | 69 | '4' => array( |
50fb255d | 70 | 'id' => '4', |
71 | 'pledge_id' => '1', | |
72 | 'scheduled_amount' => '20.00', | |
73 | 'currency' => 'USD', | |
74 | 'scheduled_date' => '20130728085413', | |
75 | 'reminder_count' => 0, | |
76 | 'status_id' => '2', | |
77 | ), | |
53ca8fd7 | 78 | '5' => array( |
50fb255d | 79 | 'id' => '5', |
80 | 'pledge_id' => '1', | |
81 | 'scheduled_amount' => '20.00', | |
82 | 'currency' => 'USD', | |
83 | 'scheduled_date' => '20130728085413', | |
84 | 'reminder_count' => 0, | |
85 | 'status_id' => '2', | |
86 | ), | |
6a488035 | 87 | ), |
50fb255d | 88 | ); |
6a488035 | 89 | |
fb32de45 | 90 | return $expectedResult; |
6a488035 TO |
91 | } |
92 | ||
a828d7b8 | 93 | /* |
50fb255d | 94 | * This example has been generated from the API test suite. |
a828d7b8 CW |
95 | * The test that created it is called "testGetPledgePayment" |
96 | * and can be found at: | |
69d79249 | 97 | * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php |
6a488035 TO |
98 | * |
99 | * You can see the outcome of the API tests at | |
69d79249 | 100 | * https://test.civicrm.org/job/CiviCRM-master-git/ |
6a488035 TO |
101 | * |
102 | * To Learn about the API read | |
69d79249 | 103 | * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API |
6a488035 | 104 | * |
69d79249 | 105 | * Browse the api on your own site with the api explorer |
41d4d31f | 106 | * http://MYSITE.ORG/path/to/civicrm/api |
6a488035 TO |
107 | * |
108 | * Read more about testing here | |
109 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
110 | * | |
111 | * API Standards documentation: | |
112 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
b259a4ab | 113 | */ |