Merge pull request #2714 from jitendrapurohit/CRMTestFix
[civicrm-core.git] / api / v3 / examples / PledgePayment / Get.php
CommitLineData
6a488035 1<?php
fb32de45 2/**
3 * Test Generated example of using pledge_payment get API
4 * *
6a488035
TO
5 */
6function pledge_payment_get_example(){
fb32de45 7$params = array();
6a488035 8
fb32de45 9try{
10 $result = civicrm_api3('pledge_payment', 'get', $params);
11}
12catch (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}
6a488035 19
fb32de45 20return $result;
6a488035
TO
21}
22
fb32de45 23/**
6a488035
TO
24 * Function returns array of result expected from previous function
25 */
26function pledge_payment_get_expectedresult(){
27
53ca8fd7 28 $expectedResult = array(
6a488035
TO
29 'is_error' => 0,
30 'version' => 3,
31 'count' => 5,
53ca8fd7 32 'values' => array(
33 '1' => array(
6a488035
TO
34 'id' => '1',
35 'pledge_id' => '1',
36 'scheduled_amount' => '20.00',
37 'currency' => 'USD',
f27f2724 38 'scheduled_date' => '20130728085413',
6a488035
TO
39 'reminder_count' => 0,
40 'status_id' => '2',
41 ),
53ca8fd7 42 '2' => array(
6a488035
TO
43 'id' => '2',
44 'pledge_id' => '1',
45 'scheduled_amount' => '20.00',
46 'currency' => 'USD',
f27f2724 47 'scheduled_date' => '20130728085413',
6a488035
TO
48 'reminder_count' => 0,
49 'status_id' => '2',
50 ),
53ca8fd7 51 '3' => array(
6a488035
TO
52 'id' => '3',
53 'pledge_id' => '1',
54 'scheduled_amount' => '20.00',
55 'currency' => 'USD',
f27f2724 56 'scheduled_date' => '20130728085413',
6a488035
TO
57 'reminder_count' => 0,
58 'status_id' => '2',
59 ),
53ca8fd7 60 '4' => array(
6a488035
TO
61 'id' => '4',
62 'pledge_id' => '1',
63 'scheduled_amount' => '20.00',
64 'currency' => 'USD',
f27f2724 65 'scheduled_date' => '20130728085413',
6a488035
TO
66 'reminder_count' => 0,
67 'status_id' => '2',
68 ),
53ca8fd7 69 '5' => array(
6a488035
TO
70 'id' => '5',
71 'pledge_id' => '1',
72 'scheduled_amount' => '20.00',
73 'currency' => 'USD',
f27f2724 74 'scheduled_date' => '20130728085413',
6a488035
TO
75 'reminder_count' => 0,
76 'status_id' => '2',
77 ),
78 ),
79);
80
fb32de45 81 return $expectedResult;
6a488035
TO
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
69d79249 89* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php
6a488035
TO
90*
91* You can see the outcome of the API tests at
69d79249 92* https://test.civicrm.org/job/CiviCRM-master-git/
6a488035
TO
93*
94* To Learn about the API read
69d79249 95* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
6a488035 96*
69d79249
E
97* Browse the api on your own site with the api explorer
98* http://MYSITE.ORG/path/to/civicrm/api/explorer
6a488035
TO
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
b259a4ab 105*/