From: eileen Date: Sun, 30 Apr 2017 00:31:32 +0000 (+1200) Subject: Fix test cleanup to turn tax & invoicing off after the test. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9fbf312fd5cabd5f7def83574b27baa6a489d6fd;p=civicrm-core.git Fix test cleanup to turn tax & invoicing off after the test. Also one typo fix (QAd from another patch) --- diff --git a/CRM/Contribute/Form/AdditionalPayment.php b/CRM/Contribute/Form/AdditionalPayment.php index aa72650c7d..a3147c1f32 100644 --- a/CRM/Contribute/Form/AdditionalPayment.php +++ b/CRM/Contribute/Form/AdditionalPayment.php @@ -587,22 +587,23 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract * * @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']; diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 0e6d1264bb..fd00e44982 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -2560,6 +2560,7 @@ AND ( TABLE_NAME LIKE 'civicrm_value_%' ) $this->restoreDefaultPriceSetConfig(); $var = TRUE; CRM_Member_BAO_Membership::createRelatedMemberships($var, $var, TRUE); + $this->disableTaxAndInvoicing(); System::singleton()->flushProcessors(); } @@ -3699,6 +3700,19 @@ AND ( TABLE_NAME LIKE 'civicrm_value_%' ) 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. *