From 35f7e125fb669147320ee2384fae099fa019cd79 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 11 Oct 2023 14:22:11 +1100 Subject: [PATCH] Fixes for removing items from collection appropriately --- tests/Unit/LateFeeTest.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/Unit/LateFeeTest.php b/tests/Unit/LateFeeTest.php index 74c708d0cacd..caa9c953422c 100644 --- a/tests/Unit/LateFeeTest.php +++ b/tests/Unit/LateFeeTest.php @@ -95,6 +95,29 @@ class LateFeeTest extends TestCase return $client; } + public function testAddLateFeeAppropriately() + { + $invoice_item = new InvoiceItem; + $invoice_item->type_id = '5'; + $invoice_item->product_key = trans('texts.fee'); + $invoice_item->notes = ctrans('texts.late_fee_added', ['date' => 'xyz']); + $invoice_item->quantity = 1; + $invoice_item->cost = 20; + + $invoice_items = $this->invoice->line_items; + $invoice_items[] = $invoice_item; + + $this->invoice->line_items = $invoice_items; + + $this->assertGreaterThan(1, count($this->invoice->line_items)); + + /**Refresh Invoice values*/ + $invoice = $this->invoice->calc()->getInvoice(); + + $this->assertGreaterThan(1, count($this->invoice->line_items)); + + } + public function testModelBehaviourInsideMap() { $i = Invoice::factory()->count(5)