From 1ec04220ef891d1fa83d0b0e40d1a642d5c0165e Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Thu, 29 Dec 2016 04:50:40 +0530 Subject: [PATCH] CRM-19585, added test ---------------------------------------- * CRM-19585: Sales tax issue https://issues.civicrm.org/jira/browse/CRM-19585 --- .../CRM/Contribute/Form/ContributionTest.php | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/phpunit/CRM/Contribute/Form/ContributionTest.php b/tests/phpunit/CRM/Contribute/Form/ContributionTest.php index e903d82463..0f0e6d69ef 100644 --- a/tests/phpunit/CRM/Contribute/Form/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/Form/ContributionTest.php @@ -810,4 +810,45 @@ Price Field - Price Field 1 1 $ 100.00 $ 100.00 $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'])); + } + } -- 2.25.1