Fix test to use valid amounts
authorEileen McNaughton <emcnaughton@wikimedia.org>
Sat, 19 Jun 2021 02:07:21 +0000 (14:07 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Sat, 19 Jun 2021 04:05:23 +0000 (16:05 +1200)
This fixes the test so the rates match the appropriate rate for the tax

tests/phpunit/api/v3/OrderTest.php

index 74f27905ab29ca354d780b9772c6b40af9c7a2bf..9e88aac0479b95d44826c929540d468f9bf678c2 100644 (file)
@@ -566,13 +566,15 @@ class api_v3_OrderTest extends CiviUnitTestCase {
    * @throws \CRM_Core_Exception
    */
   public function testCreateOrderIfTotalAmountDoesMatchLineItemsAmountsAndTaxSupplied(): void {
+    $this->enableTaxAndInvoicing();
+    $this->createFinancialTypeWithSalesTax();
     $params = [
       'contact_id' => $this->_individualId,
       'receive_date' => '2018-01-01',
-      'total_amount' => 50,
+      'total_amount' => 36.75,
       'financial_type_id' => $this->_financialTypeId,
       'contribution_status_id' => 'Pending',
-      'tax_amount' => 15,
+      'tax_amount' => 1.75,
       'line_items' => [
         0 => [
           'line_item' => [
@@ -584,9 +586,9 @@ class api_v3_OrderTest extends CiviUnitTestCase {
               'qty' => 1,
               'unit_price' => 35,
               'line_total' => 35,
-              'financial_type_id' => 1,
+              'financial_type_id' => $this->ids['FinancialType']['taxable'],
               'entity_table' => 'civicrm_contribution',
-              'tax_amount' => 15,
+              'tax_amount' => 1.75,
             ],
           ],
         ],