From 0051145d2e9fad0d9dc89f1cdc137494f0aec73d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 4 Sep 2019 15:15:42 +1000 Subject: [PATCH] Working on invoice item tax calculations --- app/Helpers/Invoice/InvoiceItemCalc.php | 2 +- tests/Unit/MakesInvoiceValuesTest.php | 17 ++--------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/app/Helpers/Invoice/InvoiceItemCalc.php b/app/Helpers/Invoice/InvoiceItemCalc.php index 4edd67ff6..3fc10fc0d 100644 --- a/app/Helpers/Invoice/InvoiceItemCalc.php +++ b/app/Helpers/Invoice/InvoiceItemCalc.php @@ -123,7 +123,7 @@ class InvoiceItemCalc $key = str_replace(" ", "", $tax_name.$tax_rate); - $group_tax = [$key => ['total' => $tax_total, 'tax_name' => $tax_name . ' ' . $tax_rate.'%']]; + $group_tax = ['key' => $key, 'total' => $tax_total, 'tax_name' => $tax_name . ' ' . $tax_rate.'%']; $this->tax_collection->push(collect($group_tax)); diff --git a/tests/Unit/MakesInvoiceValuesTest.php b/tests/Unit/MakesInvoiceValuesTest.php index a00af9964..d42594e26 100644 --- a/tests/Unit/MakesInvoiceValuesTest.php +++ b/tests/Unit/MakesInvoiceValuesTest.php @@ -74,22 +74,9 @@ class MakesInvoiceValuesTest extends TestCase } - $this->assertEquals("GST10.00", print_r($tax_array)); - // $this->assertEquals("GST10.00", $keys->keys()); + //$this->assertEquals("GST10.00", print_r($tax_array)); + $this->assertEquals(100, $tax_array[0]['total']); - foreach($keys as $key) - { - - $this->assertEquals("GST10.00", $key); - - $tax_group = $taxes->groupBy($key); - - $this->assertEquals('hi', $tax_group); - $tax_group->sum('total'); - - $this->assertEquals(100, $tax_group->sum('total')); - - }