Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
fb32de45 | 2 | /** |
3 | * Test Generated example of using contribution_page get API | |
4 | * * | |
6a488035 TO |
5 | */ |
6 | function contribution_page_get_example(){ | |
edb0d67a | 7 | $params = array( |
6a488035 TO |
8 | 'amount' => '34567', |
9 | 'currency' => 'NZD', | |
10 | 'financial_type_id' => 1, | |
11 | ); | |
12 | ||
fb32de45 | 13 | try{ |
14 | $result = civicrm_api3('contribution_page', 'get', $params); | |
15 | } | |
16 | catch (CiviCRM_API3_Exception $e) { | |
17 | // handle error here | |
18 | $errorMessage = $e->getMessage(); | |
19 | $errorCode = $e->getErrorCode(); | |
20 | $errorData = $e->getExtraParams(); | |
21 | return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); | |
22 | } | |
6a488035 | 23 | |
fb32de45 | 24 | return $result; |
6a488035 TO |
25 | } |
26 | ||
fb32de45 | 27 | /** |
6a488035 TO |
28 | * Function returns array of result expected from previous function |
29 | */ | |
30 | function contribution_page_get_expectedresult(){ | |
31 | ||
edb0d67a | 32 | $expectedResult = array( |
6a488035 TO |
33 | 'is_error' => 0, |
34 | 'version' => 3, | |
35 | 'count' => 1, | |
36 | 'id' => 3, | |
edb0d67a | 37 | 'values' => array( |
38 | '3' => array( | |
6a488035 TO |
39 | 'id' => '3', |
40 | 'title' => 'Test Contribution Page', | |
41 | 'financial_type_id' => '1', | |
42 | 'is_credit_card_only' => 0, | |
43 | 'is_monetary' => '1', | |
44 | 'is_recur' => 0, | |
45 | 'is_confirm_enabled' => '1', | |
46 | 'is_recur_interval' => 0, | |
47 | 'is_recur_installments' => 0, | |
48 | 'is_pay_later' => 0, | |
49 | 'is_partial_payment' => 0, | |
50 | 'is_allow_other_amount' => 0, | |
51 | 'goal_amount' => '34567.00', | |
52 | 'is_for_organization' => 0, | |
53 | 'is_email_receipt' => 0, | |
54 | 'amount_block_is_active' => '1', | |
55 | 'currency' => 'NZD', | |
56 | 'is_share' => '1', | |
57 | ), | |
58 | ), | |
59 | ); | |
60 | ||
fb32de45 | 61 | return $expectedResult; |
6a488035 TO |
62 | } |
63 | ||
64 | ||
65 | /* | |
66 | * This example has been generated from the API test suite. The test that created it is called | |
67 | * | |
68 | * testGetContributionPageByAmount and can be found in | |
69 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContributionPageTest.php | |
70 | * | |
71 | * You can see the outcome of the API tests at | |
72 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
73 | * | |
74 | * To Learn about the API read | |
75 | * http://book.civicrm.org/developer/current/techniques/api/ | |
76 | * | |
77 | * and review the wiki at | |
78 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
79 | * | |
80 | * Read more about testing here | |
81 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
82 | * | |
83 | * API Standards documentation: | |
84 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
85 | */ |