/**
* Test APIv3 civicrm_contribute_* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_ContributionSoft
+ * @package CiviCRM_APIv3
+ * @subpackage API_ContributionSoft
*/
-
class api_v3_ContributionSoftTest extends CiviUnitTestCase {
/**
'contact_id' => $this->_individualId,
'receive_date' => '20120511',
'total_amount' => 100.00,
- 'financial_type_id' => $this->_financialTypeId,
+ 'financial_type_id' => $this->_financialTypeId,
'non_deductible_amount' => 10.00,
'fee_amount' => 5.00,
'net_amount' => 95.00,
//create a second soft contribution on the same hard contribution - we are testing that 'id' gets the right soft contribution id (not the contribution id)
$p['contact_id'] = $this->_softIndividual2Id;
- $this->_softcontribution2 = $this->callAPISuccess('contribution_soft', 'create', $p);
+ $this->_softcontribution2 = $this->callAPISuccess('contribution_soft', 'create', $p);
// now we have 2 - test getcount
- $softcontribution = $this->callAPISuccess('contribution_soft', 'getcount', array());
+ $softcontribution = $this->callAPISuccess('contribution_soft', 'getcount', array());
$this->assertEquals(2, $softcontribution);
//check first contribution
- $result = $this->callAPISuccess('contribution_soft', 'get', array(
+ $result = $this->callAPISuccess('contribution_soft', 'get', array(
'id' => $this->_softcontribution['id'],
));
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
$this->assertEquals($this->_softcontribution['id'], $result['id']);
- $this->assertEquals($this->_softcontribution['id'], $result['id'], print_r($softcontribution,true));
+ $this->assertEquals($this->_softcontribution['id'], $result['id'], print_r($softcontribution, TRUE));
//test id only format - second soft credit
- $resultID2 = $this->callAPISuccess('contribution_soft', 'get', array(
+ $resultID2 = $this->callAPISuccess('contribution_soft', 'get', array(
'id' => $this->_softcontribution2['id'],
'format.only_id' => 1,
));
$this->assertEquals($this->_softcontribution2['id'], $resultID2);
//test get by contact id works
- $result = $this->callAPISuccess('contribution_soft', 'get', array(
- 'contact_id' => $this->_softIndividual2Id)
+ $result = $this->callAPISuccess('contribution_soft', 'get', array(
+ 'contact_id' => $this->_softIndividual2Id
+ )
);
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
$this->callAPISuccess('contribution_soft', 'getcount', array(), $expectedCount);
//check id is same as 2
- $this->assertEquals($this->_softcontribution2['id'], $this->callAPISuccess('contribution_soft', 'getvalue', array('return' => 'id' )));
+ $this->assertEquals($this->_softcontribution2['id'], $this->callAPISuccess('contribution_soft', 'getvalue', array('return' => 'id')));
$this->callAPISuccess('ContributionSoft', 'Delete', array(
'id' => $this->_softcontribution2['id'],
- ));
+ ));
}
);
}
- /*
+ /**
* Function tests that additional financial records are created when fee amount is recorded
*/
public function testCreateContributionSoft() {
$this->assertEquals($old_contact_id, $this->_softIndividual1Id, 'In line ' . __LINE__);
$this->assertEquals($old_amount, 10.00, 'In line ' . __LINE__);
$this->assertEquals($old_currency, 'USD', 'In line ' . __LINE__);
- $this->assertEquals($old_soft_credit_type_id, 6 , 'In line ' . __LINE__);
+ $this->assertEquals($old_soft_credit_type_id, 6, 'In line ' . __LINE__);
$params = array(
'id' => $softcontributionID,
'contribution_id' => $this->_contributionId,
$this->assertEquals($p2['contribution_id'], $res['contribution_id'], 'In line ' . __LINE__);
$this->assertEquals($p2['contact_id'], $res['contact_id'], 'In line ' . __LINE__);
$this->assertEquals($p2['amount'], $res['amount'], 'In line ' . __LINE__);
- $this->assertEquals($p2['currency'], $res['currency'], 'In line ' . __LINE__ );
+ $this->assertEquals($p2['currency'], $res['currency'], 'In line ' . __LINE__);
}
}