Merge pull request #2288 from eileenmcnaughton/CRM-14043
[civicrm-core.git] / api / v3 / examples / PledgePaymentGet.php
1 <?php
2 /**
3 * Test Generated example of using pledge_payment get API
4 * *
5 */
6 function pledge_payment_get_example(){
7 $params = array();
8
9 try{
10 $result = civicrm_api3('pledge_payment', 'get', $params);
11 }
12 catch (CiviCRM_API3_Exception $e) {
13 // handle error here
14 $errorMessage = $e->getMessage();
15 $errorCode = $e->getErrorCode();
16 $errorData = $e->getExtraParams();
17 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
18 }
19
20 return $result;
21 }
22
23 /**
24 * Function returns array of result expected from previous function
25 */
26 function pledge_payment_get_expectedresult(){
27
28 $expectedResult = array(
29 'is_error' => 0,
30 'version' => 3,
31 'count' => 5,
32 'values' => array(
33 '1' => array(
34 'id' => '1',
35 'pledge_id' => '1',
36 'scheduled_amount' => '20.00',
37 'currency' => 'USD',
38 'scheduled_date' => '20130728085413',
39 'reminder_count' => 0,
40 'status_id' => '2',
41 ),
42 '2' => array(
43 'id' => '2',
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 ),
51 '3' => array(
52 'id' => '3',
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 ),
60 '4' => array(
61 'id' => '4',
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 ),
69 '5' => array(
70 'id' => '5',
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 ),
78 ),
79 );
80
81 return $expectedResult;
82 }
83
84
85 /*
86 * This example has been generated from the API test suite. The test that created it is called
87 *
88 * testGetPledgePayment and can be found in
89 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/PledgePaymentTest.php
90 *
91 * You can see the outcome of the API tests at
92 * http://tests.dev.civicrm.org/trunk/results-api_v3
93 *
94 * To Learn about the API read
95 * http://book.civicrm.org/developer/current/techniques/api/
96 *
97 * and review the wiki at
98 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
99 *
100 * Read more about testing here
101 * http://wiki.civicrm.org/confluence/display/CRM/Testing
102 *
103 * API Standards documentation:
104 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
105 */