3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
28 require_once 'CiviTest/CiviUnitTestCase.php';
31 * Class CRM_Contribute_BAO_ContributionRecurTest
33 class CRM_Contribute_BAO_ContributionRecurTest
extends CiviUnitTestCase
{
34 protected $_params = array();
36 public function setUp() {
38 $this->_ids
['payment_processor'] = $this->paymentProcessorCreate();
39 $this->_params
= array(
40 'contact_id' => $this->individualCreate(),
42 'frequency_unit' => 'week',
43 'frequency_interval' => 1,
45 'start_date' => 'yesterday',
46 'create_date' => 'yesterday',
47 'modified_date' => 'yesterday',
48 'cancel_date' => NULL,
49 'end_date' => '+ 2 weeks',
50 'processor_id' => '643411460836',
51 'trxn_id' => 'e0d0808e26f3e661c6c18eb7c039d363',
52 'invoice_id' => 'e0d0808e26f3e661c6c18eb7c039d363',
53 'contribution_status_id' => 1,
56 'next_sched_contribution_date' => '+ 1 week',
58 'failure_retry_date' => NULL,
61 'payment_processor_id' => $this->_ids
['payment_processor'],
62 'is_email_receipt' => 1,
63 'financial_type_id' => 1,
64 'payment_instrument_id' => 1,
65 'campaign_id' => NULL,
69 public function teardown() {
70 $this->quickCleanup(array('civicrm_contribution_recur', 'civicrm_payment_processor'));
74 * Test that an object can be retrieved & saved (per CRM-14986).
76 * This has been causing a DB error so we are checking for absence of error
78 public function testFindSave() {
79 $contributionRecur = $this->callAPISuccess('contribution_recur', 'create', $this->_params
);
80 $dao = new CRM_Contribute_BAO_ContributionRecur();
81 $dao->id
= $contributionRecur['id'];
83 $dao->is_email_receipt
= 0;
88 * Test cancellation works per CRM-14986.
90 * We are checking for absence of error.
92 public function testCancelRecur() {
93 $contributionRecur = $this->callAPISuccess('contribution_recur', 'create', $this->_params
);
94 CRM_Contribute_BAO_ContributionRecur
::cancelRecurContribution($contributionRecur['id'], CRM_Core_DAO
::$_nullObject);