Skip to content

Commit

Permalink
CRM-19585, added test
Browse files Browse the repository at this point in the history
----------------------------------------
* CRM-19585: Sales tax issue
  https://issues.civicrm.org/jira/browse/CRM-19585
  • Loading branch information
pradpnayak committed Dec 28, 2016
1 parent 7a1f391 commit 1ec0422
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tests/phpunit/CRM/Contribute/Form/ContributionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -810,4 +810,45 @@ public function testSubmitSaleTax() {
$this->assertEquals(10, $lineItem['tax_amount']);
}

/**
* Test the submit function for FT without tax.
*/
public function testSubmitWithOutSaleTax() {
$this->enableTaxAndInvoicing();
$this->relationForFinancialTypeWithFinancialAccount($this->_financialTypeId);
$form = new CRM_Contribute_Form_Contribution();

$form->testSubmit(array(
'total_amount' => 100,
'financial_type_id' => 3,
'receive_date' => '04/21/2015',
'receive_date_time' => '11:27PM',
'contact_id' => $this->_individualId,
'payment_instrument_id' => array_search('Check', $this->paymentInstruments),
'contribution_status_id' => 1,
'price_set_id' => 0,
),
CRM_Core_Action::ADD
);
$contribution = $this->callAPISuccessGetSingle('Contribution',
array(
'contact_id' => $this->_individualId,
'return' => array('tax_amount', 'total_amount'),
)
);
$this->assertEquals(100, $contribution['total_amount']);
$this->assertEquals(NULL, $contribution['tax_amount']);
$this->callAPISuccessGetCount('FinancialTrxn', array(), 1);
$this->callAPISuccessGetCount('FinancialItem', array(), 1);
$lineItem = $this->callAPISuccessGetSingle(
'LineItem',
array(
'contribution_id' => $contribution['id'],
'return' => array('line_total', 'tax_amount'),
)
);
$this->assertEquals(100, $lineItem['line_total']);
$this->assertTrue(empty($lineItem['tax_amount']));
}

}

0 comments on commit 1ec0422

Please sign in to comment.