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

Fix test cleanup to turn tax & invoicing off after the test. #10286

Merged
merged 1 commit into from
Apr 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions CRM/Contribute/Form/AdditionalPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -587,22 +587,23 @@ public function emailReceipt(&$params) {
*
* @param array $params
* @param string|null $creditCardMode
* @param string $enitityType
* @param string $entityType
*
* @throws \CiviCRM_API3_Exception
*/
public function testSubmit($params, $creditCardMode = NULL, $enitityType = 'contribute') {
public function testSubmit($params, $creditCardMode = NULL, $entityType = 'contribute') {
$this->_bltID = 5;
// Required because processCreditCard calls set method on this.
$_SERVER['REQUEST_METHOD'] = 'GET';
$this->controller = new CRM_Core_Controller();

$this->assignPaymentRelatedVariables();

if (!empty($params['contribution_id'])) {
$this->_contributionId = $params['contribution_id'];

$paymentInfo = CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType($this->_contributionId, $enitityType);
$paymentDetails = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_contributionId, $enitityType, FALSE, TRUE);
$paymentInfo = CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType($this->_contributionId, $entityType);
$paymentDetails = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_contributionId, $entityType, FALSE, TRUE);

$this->_amtPaid = $paymentDetails['paid'];
$this->_amtTotal = $paymentDetails['total'];
Expand Down
14 changes: 14 additions & 0 deletions tests/phpunit/CiviTest/CiviUnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2560,6 +2560,7 @@ public function quickCleanUpFinancialEntities() {
$this->restoreDefaultPriceSetConfig();
$var = TRUE;
CRM_Member_BAO_Membership::createRelatedMemberships($var, $var, TRUE);
$this->disableTaxAndInvoicing();
System::singleton()->flushProcessors();
}

Expand Down Expand Up @@ -3699,6 +3700,19 @@ protected function enableTaxAndInvoicing($params = array()) {
return Civi::settings()->set('contribution_invoice_settings', $contributeSetting);
}

/**
* Enable Tax and Invoicing
*/
protected function disableTaxAndInvoicing($params = array()) {
// Enable component contribute setting
$contributeSetting = array_merge($params,
array(
'invoicing' => 0,
)
);
return Civi::settings()->set('contribution_invoice_settings', $contributeSetting);
}

/**
* Add Sales Tax relation for financial type with financial account.
*
Expand Down