From c004a5fe00b4c916bae08adc832ce07160aa5749 Mon Sep 17 00:00:00 2001 From: Joe Z Date: Fri, 10 Feb 2012 11:56:50 -0500 Subject: [PATCH] #12 pulished tests --- src/Siwapp/CoreBundle/Entity/AbstractInvoice.php | 5 +++-- src/Siwapp/InvoiceBundle/Tests/Model/InvoiceTest.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Siwapp/CoreBundle/Entity/AbstractInvoice.php b/src/Siwapp/CoreBundle/Entity/AbstractInvoice.php index 36eec88..9b1326a 100644 --- a/src/Siwapp/CoreBundle/Entity/AbstractInvoice.php +++ b/src/Siwapp/CoreBundle/Entity/AbstractInvoice.php @@ -529,11 +529,12 @@ public function removeItem($mixed) { if($mixed instanceof \Siwapp\CoreBundle\Entity\AbstractItem) { - foreach($this->getItems() as $ref => $item) + $items = $this->getItems(); + foreach($items as $ref => $item) { if($item === $mixed) { - unset($this->items[$ref]); + unset($items[$ref]); break; } } diff --git a/src/Siwapp/InvoiceBundle/Tests/Model/InvoiceTest.php b/src/Siwapp/InvoiceBundle/Tests/Model/InvoiceTest.php index c71a198..307f3c5 100644 --- a/src/Siwapp/InvoiceBundle/Tests/Model/InvoiceTest.php +++ b/src/Siwapp/InvoiceBundle/Tests/Model/InvoiceTest.php @@ -34,7 +34,7 @@ public function testTrial() $new_item->setQuantity(1); $new_item->setDiscount(0); $this->em->persist($new_item); - $test_invoice->addItem($new_item); + $test_invoice->addNewItem($new_item); $this->em->flush(); $this->assertEquals($test_invoice->getGrossAmount(),8172.36); // recalculate when updating item