+--------------------------------------------------------------------+
| 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 class for Pledge API - civicrm_pledge_*
*
- * @package CiviCRM_APIv3
+ * @package CiviCRM_APIv3
*/
-
class api_v3_PledgePaymentTest extends CiviUnitTestCase {
/**
- * Assume empty database with just civicrm_data
+ * Assume empty database with just civicrm_data.
*/
protected $_individualId;
protected $_pledgeID;
}
/**
- * Test that passing in a single variable works
+ * Test that passing in a single variable works.
*/
public function testGetSinglePledgePayment() {
$createparams = array(
}
/**
- * Test that creating a payment will add the contribution ID
+ * Test that creating a payment will add the contribution ID.
*/
public function testCreatePledgePayment() {
//check that 5 pledge payments exist at the start
$contribution = $this->callAPISuccess('contribution', 'create', $contributionParams);
$params['contribution_id'] = $contribution['id'];
-
$resultCont2 = $this->callAPISuccess('pledge_payment', 'create', $params);
//make sure original is untouched & has not been updated
$this->assertGreaterThan($result['id'], $resultCont2['id'], " in line " . __LINE__);
}
/**
- * Test checks behaviour when more payments are created than should be possible
+ * Test checks behaviour when more payments are created than should be possible.
*/
public function testCreatePledgePaymentAllCreated() {
$params = array(
$params['scheduled_date'] = '20131212';
$resultcreatenew = $this->callAPISuccess('pledge_payment', 'create', $params);
$result = $this->callAPISuccess('PledgePayment', 'Get', array(
- 'pledge_id' => $this->_pledgeID,
- ));
+ 'pledge_id' => $this->_pledgeID,
+ ));
$this->assertEquals(6, $result['count']);
}
/**
- * Test that creating a payment will add the contribution ID where only one pledge payment
- * in schedule
+ * Test that creating a payment adds the contribution ID where only one pledge payment is in schedule.
*/
public function testCreatePledgePaymentWhereOnlyOnePayment() {
$pledgeParams = array(
//check existing updated not new one created - 'create' means add contribution_id in this context
$afterAdd = $this->callAPISuccess('pledge_payment', 'get', array(
'contribution_id' => $contributionID,
- ));
+ ));
$this->assertEquals(1, $afterAdd['count'], " in line " . __LINE__);
}
);
$result = $this->callAPIAndDocument('pledge_payment', 'update', $updateparams, __FUNCTION__, __FILE__);
- $this->getAndCheck(array_merge($params,$updateparams), $result['id'], $this->_entity);
+ $this->getAndCheck(array_merge($params, $updateparams), $result['id'], $this->_entity);
}
public function testDeletePledgePayment() {
$result = $this->callAPISuccess('PledgePayment', 'GetFields', array());
$this->assertType('array', $result);
}
+
}