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';
29 class CRM_Contribute_BAO_ContributionRecurTest
extends CiviUnitTestCase
{
30 protected $_params = array();
32 public function setUp() {
34 $this->_ids
['payment_processor'] = $this->paymentProcessorCreate();
35 $this->_params
= array(
36 'contact_id' => $this->individualCreate(),
38 'frequency_unit' => 'week',
39 'frequency_interval' => 1,
41 'start_date' => 'yesterday',
42 'create_date' => 'yesterday',
43 'modified_date' => 'yesterday',
44 'cancel_date' => NULL,
45 'end_date' => '+ 2 weeks',
46 'processor_id' => '643411460836',
47 'trxn_id' => 'e0d0808e26f3e661c6c18eb7c039d363',
48 'invoice_id' => 'e0d0808e26f3e661c6c18eb7c039d363',
49 'contribution_status_id' => 1,
52 'next_sched_contribution_date' => '+ 1 week',
54 'failure_retry_date' => NULL,
57 'payment_processor_id' => $this->_ids
['payment_processor'],
58 'is_email_receipt' => 1,
59 'financial_type_id' => 1,
60 'payment_instrument_id' => 1,
61 'campaign_id' => NULL,
65 public function teardown() {
66 $this->quickCleanup(array('civicrm_contribution_recur', 'civicrm_payment_processor'));
70 * Test that an object can be retrieved & saved (per CRM-14986)
71 * this has been causing a DB error so we are checking for absence of error
73 public function testFindSave() {
74 $contributionRecur = $this->callAPISuccess('contribution_recur', 'create', $this->_params
);
75 $dao = new CRM_Contribute_BAO_ContributionRecur();
76 $dao->id
= $contributionRecur['id'];
78 $dao->is_email_receipt
= 0;
83 * Test cancellation works per CRM-14986
84 * we are checking for absence of error
86 public function testCancelRecur() {
87 $contributionRecur = $this->callAPISuccess('contribution_recur', 'create', $this->_params
);
88 CRM_Contribute_BAO_ContributionRecur
::cancelRecurContribution($contributionRecur['id'], CRM_Core_DAO
::$_nullObject);