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