From 5b677545955e03200ef93bc88cdc75cca8afffc9 Mon Sep 17 00:00:00 2001 From: romanb Date: Wed, 1 Jul 2009 13:45:31 +0000 Subject: [PATCH] [2.0] Simplifying code. Including OneToManyBidirectionalAssociation test in AllTests --- .../Tests/Models/ECommerce/ECommerceProduct.php | 10 ++++------ tests/Doctrine/Tests/ORM/Functional/AllTests.php | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php b/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php index 492129ff5..ce6c6e122 100644 --- a/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php +++ b/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php @@ -89,12 +89,10 @@ class ECommerceProduct } public function removeFeature(ECommerceFeature $feature) { - foreach ($this->features as $index => $current) { - if ($current === $feature) { - unset($this->features[$index]); - $current->removeProduct(); - return true; - } + $removed = $this->features->removeElement($feature); + if ($removed !== null) { + $removed->removeProduct(); + return true; } return false; } diff --git a/tests/Doctrine/Tests/ORM/Functional/AllTests.php b/tests/Doctrine/Tests/ORM/Functional/AllTests.php index 717450143..a8b87e221 100644 --- a/tests/Doctrine/Tests/ORM/Functional/AllTests.php +++ b/tests/Doctrine/Tests/ORM/Functional/AllTests.php @@ -28,6 +28,7 @@ class AllTests $suite->addTestSuite('Doctrine\Tests\ORM\Functional\QueryTest'); $suite->addTestSuite('Doctrine\Tests\ORM\Functional\OneToOneUnidirectionalAssociationTest'); $suite->addTestSuite('Doctrine\Tests\ORM\Functional\OneToOneBidirectionalAssociationTest'); + $suite->addTestSuite('Doctrine\Tests\ORM\Functional\OneToManyBidirectionalAssociationTest'); return $suite; }