From 40f53e3dde0446469578793eff03250716eb7bff Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 25 Mar 2023 09:26:27 +1100 Subject: [PATCH] Refactor for taxes --- app/DataMapper/Tax/ClientTaxData.php | 28 ------------------- app/DataMapper/Tax/CompanyTaxData.php | 28 ------------------- .../Tax/{InvoiceTaxData.php => TaxData.php} | 2 +- tests/Unit/Tax/SumTaxTest.php | 18 ++++++------ 4 files changed, 9 insertions(+), 67 deletions(-) delete mode 100644 app/DataMapper/Tax/ClientTaxData.php delete mode 100644 app/DataMapper/Tax/CompanyTaxData.php rename app/DataMapper/Tax/{InvoiceTaxData.php => TaxData.php} (96%) diff --git a/app/DataMapper/Tax/ClientTaxData.php b/app/DataMapper/Tax/ClientTaxData.php deleted file mode 100644 index 3f92e8866781..000000000000 --- a/app/DataMapper/Tax/ClientTaxData.php +++ /dev/null @@ -1,28 +0,0 @@ -company->calculate_taxes = false; @@ -108,7 +106,7 @@ class SumTaxTest extends TestCase $line_items = []; - $invoice->tax_data = new InvoiceTaxData($this->response); + $invoice->tax_data = new TaxData($this->response); $line_item = new InvoiceItem(); $line_item->quantity = 1; @@ -131,7 +129,7 @@ class SumTaxTest extends TestCase $this->assertEquals(0, $line_items[0]->tax_rate1); } - + /** Proves that we do calc taxes automatically */ public function testCalcInvoiceTax() { @@ -151,7 +149,7 @@ class SumTaxTest extends TestCase $line_items = []; - $invoice->tax_data = new InvoiceTaxData($this->response); + $invoice->tax_data = new TaxData($this->response); $line_item = new InvoiceItem; $line_item->quantity = 1; @@ -177,7 +175,7 @@ class SumTaxTest extends TestCase public function testTaxOnCompany() { - $tax_class = new CompanyTaxData($this->response); + $tax_class = new TaxData($this->response); $this->company->tax_data = $tax_class; $this->company->save(); @@ -194,7 +192,7 @@ class SumTaxTest extends TestCase 'company_id' => $this->company->id, ]); - $tax_class = new ClientTaxData($this->response, $this->response); + $tax_class = new TaxData($this->response, $this->response); $c->tax_data = $tax_class; $c->save(); @@ -213,7 +211,7 @@ class SumTaxTest extends TestCase 'user_id' => $this->user->id, ]); - $tax_class = new InvoiceTaxData($this->response); + $tax_class = new TaxData($this->response); $i->tax_data = $tax_class; $i->save();