Merge pull request #2714 from jitendrapurohit/CRMTestFix
[civicrm-core.git] / api / v3 / examples / Pledge / GetFilterHighDate.php
CommitLineData
6a488035 1<?php
fb32de45 2/**
3 * Test Generated example of using pledge get API
4 * demonstrates high date filter *
6a488035
TO
5 */
6function pledge_get_example(){
53ca8fd7 7$params = array(
69d79249 8 'pledge_start_date_high' => '20140211002809',
6a488035
TO
9);
10
fb32de45 11try{
12 $result = civicrm_api3('pledge', 'get', $params);
13}
14catch (CiviCRM_API3_Exception $e) {
15 // handle error here
16 $errorMessage = $e->getMessage();
17 $errorCode = $e->getErrorCode();
18 $errorData = $e->getExtraParams();
19 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
20}
6a488035 21
fb32de45 22return $result;
6a488035
TO
23}
24
fb32de45 25/**
6a488035
TO
26 * Function returns array of result expected from previous function
27 */
28function pledge_get_expectedresult(){
29
53ca8fd7 30 $expectedResult = array(
6a488035
TO
31 'is_error' => 0,
32 'version' => 3,
33 'count' => 1,
34 'id' => 2,
53ca8fd7 35 'values' => array(
36 '2' => array(
6a488035
TO
37 'contact_id' => '8',
38 'contact_type' => 'Individual',
39 'contact_sub_type' => '',
40 'sort_name' => 'Anderson, Anthony',
41 'display_name' => 'Mr. Anthony Anderson II',
42 'pledge_id' => '2',
43 'pledge_amount' => '100.00',
69d79249 44 'pledge_create_date' => '2014-02-13 00:00:00',
6a488035
TO
45 'pledge_status' => 'Overdue',
46 'pledge_total_paid' => '',
b259a4ab 47 'pledge_next_pay_date' => '2013-03-01 00:00:00',
6a488035
TO
48 'pledge_next_pay_amount' => '20.00',
49 'pledge_outstanding_amount' => '20.00',
50 'pledge_financial_type' => 'Donation',
51 'pledge_contribution_page_id' => '',
52 'pledge_frequency_interval' => '5',
53 'pledge_frequency_unit' => 'year',
54 'pledge_is_test' => 0,
55 'pledge_campaign_id' => '',
56 'pledge_currency' => 'USD',
57 'id' => '2',
58 ),
59 ),
60);
61
fb32de45 62 return $expectedResult;
6a488035
TO
63}
64
65
66/*
67* This example has been generated from the API test suite. The test that created it is called
68*
69* testPledgeGetReturnFilters and can be found in
69d79249 70* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php
6a488035
TO
71*
72* You can see the outcome of the API tests at
69d79249 73* https://test.civicrm.org/job/CiviCRM-master-git/
6a488035
TO
74*
75* To Learn about the API read
69d79249 76* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
6a488035 77*
69d79249
E
78* Browse the api on your own site with the api explorer
79* http://MYSITE.ORG/path/to/civicrm/api/explorer
6a488035
TO
80*
81* Read more about testing here
82* http://wiki.civicrm.org/confluence/display/CRM/Testing
83*
84* API Standards documentation:
85* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
b259a4ab 86*/