Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
aba1cd8b EM |
2 | |
3 | /** | |
4 | * Class ContributionPage | |
5 | */ | |
6a488035 TO |
6 | class ContributionPage extends PHPUnit_Framework_Testcase { |
7 | /** | |
eceb18cc | 8 | * Helper function to create. |
6a488035 TO |
9 | * a Contribution Page |
10 | * | |
100fef9d | 11 | * @param int $id |
2a6da8d7 | 12 | * |
72b3a70c CW |
13 | * @return int |
14 | * id of created Contribution Page | |
6a488035 | 15 | */ |
00be9182 | 16 | public static function create($id = NULL) { |
6a488035 TO |
17 | require_once "CRM/Contribute/BAO/ContributionPage.php"; |
18 | $params = array( | |
19 | 'title' => 'Help Test CiviCRM!', | |
20 | 'intro_text' => 'Created for Test Coverage Online Contribution Page', | |
21 | 'financial_type_id' => 1, | |
22 | 'payment_processor_id' => $id, | |
23 | 'is_monetary' => 1, | |
24 | 'is_allow_other_amount' => 1, | |
25 | 'min_amount' => 10, | |
26 | 'max_amount' => 10000, | |
27 | 'goal_amount' => 100000, | |
2b3846c2 | 28 | 'thankyou_title' => 'Thank you for your support!', |
6a488035 TO |
29 | 'thankyou_text' => 'Thank you for your support.', |
30 | 'is_email_receipt' => 1, | |
31 | 'receipt_from_name' => 'From TEST', | |
32 | 'receipt_from_email' => 'donations@civicrm.org', | |
33 | 'cc_receipt' => 'receipt@example.com', | |
34 | 'bcc_receipt' => 'bcc@example.com', | |
35 | 'is_active' => 1, | |
36 | ); | |
37 | ||
38 | $contributionPage = CRM_Contribute_BAO_ContributionPage::create($params); | |
39 | return $contributionPage->id; | |
40 | } | |
41 | ||
42 | /** | |
eceb18cc | 43 | * Helper function to delete a Contribution Page. |
6a488035 | 44 | * |
e16033b4 TO |
45 | * @param int $contributionPageId |
46 | * Id of the Contribution Page. | |
16b10e64 | 47 | * to be deleted |
317fceb4 | 48 | * @return bool |
a6c01b45 | 49 | * true if Contribution Page deleted, false otherwise |
6a488035 | 50 | */ |
00be9182 | 51 | public static function delete($contributionPageId) { |
6a488035 TO |
52 | require_once "CRM/Contribute/DAO/ContributionPage.php"; |
53 | $cp = new CRM_Contribute_DAO_ContributionPage(); | |
54 | $cp->id = $contributionPageId; | |
55 | if ($cp->find(TRUE)) { | |
56 | $result = $cp->delete(); | |
57 | } | |
58 | return $result; | |
59 | } | |
96025800 | 60 | |
6a488035 | 61 | } |