Fix test cleanup to turn tax & invoicing off after the test.
authoreileen <emcnaughton@wikimedia.org>
Sun, 30 Apr 2017 00:31:32 +0000 (12:31 +1200)
committereileen <emcnaughton@wikimedia.org>
Sun, 30 Apr 2017 00:31:38 +0000 (12:31 +1200)
Also one typo fix (QAd from another patch)

CRM/Contribute/Form/AdditionalPayment.php
tests/phpunit/CiviTest/CiviUnitTestCase.php

index aa72650c7db5ca18dc02339d9f34f40b3c5c1af0..a3147c1f325aa332235910fd005871214732b4a8 100644 (file)
@@ -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'];
index 0e6d1264bb0dc54339c790b4ec21dc4db0f6f0d1..fd00e44982f44c1fba1b5a28aba951c2d3f4acbd 100644 (file)
@@ -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.
    *