<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
require_once 'CiviTest/CiviUnitTestCase.php';
/**
* Test APIv3 civicrm_contribute_recur* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Contribution
+ * @package CiviCRM_APIv3
+ * @subpackage API_Contribution
*/
-
-
class api_v3_ContributionRecurTest extends CiviUnitTestCase {
protected $_apiversion = 3;
protected $params;
public $DBResetRequired = FALSE;
- function setUp() {
+ public function setUp() {
parent::setUp();
+ $this->useTransaction(TRUE);
$this->ids['contact'][0] = $this->individualCreate();
$this->params = array(
'contact_id' => $this->ids['contact'][0],
);
}
- function tearDown() {
- foreach ($this->ids as $entity => $entities) {
- foreach ($entities as $id) {
- $this->callAPISuccess($entity, 'delete', array('id' => $id));
- }
- }
- $tablesToTruncate = array(
- 'civicrm_financial_type',
- 'civicrm_contribution',
- 'civicrm_contribution_recur',
- 'civicrm_membership',
- );
- $this->quickCleanup($tablesToTruncate);
- }
-
public function testCreateContributionRecur() {
$result = $this->callAPIAndDocument($this->_entity, 'create', $this->params, __FUNCTION__, __FILE__);
$this->assertEquals(1, $result['count']);
$result = $this->callAPISuccess($this->_entity, 'create', $this->params);
$deleteParams = array('id' => $result['id']);
$result = $this->callAPIAndDocument($this->_entity, 'delete', $deleteParams, __FUNCTION__, __FILE__);
- $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array(
- ));
+ $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array());
$this->assertEquals(0, $checkDeleted['count']);
}
$result = $this->callAPISuccess($this->_entity, 'getfields', array('action' => 'create'));
$this->assertEquals(12, $result['values']['start_date']['type']);
}
-}
+}