Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-19966 Unfair Double Taxation and net_amounts. #9948

Merged
merged 7 commits into from
Mar 10, 2017
54 changes: 54 additions & 0 deletions tests/phpunit/CRM/Contribute/Form/ContributionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -851,4 +851,58 @@ public function testSubmitWithOutSaleTax() {
$this->assertTrue(empty($lineItem['tax_amount']));
}

public function testReSubmitSaleTax() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not working yet!

// KG I need to do an Edit of a View Contribution
$this->enableTaxAndInvoicing();
$this->relationForFinancialTypeWithFinancialAccount($this->_financialTypeId);
$form = new CRM_Contribute_Form_Contribution();

$form->testSubmit(array(
'total_amount' => 100,
'financial_type_id' => $this->_financialTypeId,
'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(
'contribution_id' => 1,
'return' => array('tax_amount', 'total_amount', 'net_amount', 'financial_type_id', 'receive_date', 'payment_instrument_id'),
)
);

$test = 1;
$form->testSubmit(array(
'contribution_id' => $contribution['id'],
'total_amount' => $contribution['total_amount'],
'net_amount' => $contribution['net_amount'],
'tax_amount' => $contribution['tax_amount'],
'financial_type_id' => $contribution['financial_type_id'],
'receive_date' => $contribution['receive_date'],
'payment_instrument_id' => $contribution['payment_instrument_id'],
'price_set_id' => 0,
'check_number' => 12345,
),
CRM_Core_Action::UPDATE
);
$contribution = $this->callAPISuccessGetSingle('Contribution',
array(
'contact_id' => $this->_individualId,
)
);

$this->assertEquals(110, $contribution['total_amount']);
$this->assertEquals(10, $contribution['tax_amount']);
$this->callAPISuccessGetCount('FinancialTrxn', array(), 1);
$this->callAPISuccessGetCount('FinancialItem', array(), 2);
$lineItem = $this->callAPISuccessGetSingle('LineItem', array('contribution_id' => $contribution['id']));
$this->assertEquals(100, $lineItem['line_total']);
$this->assertEquals(10, $lineItem['tax_amount']);
}

}