From 9acf1702921afbebdd9e825b42364557b92460bd Mon Sep 17 00:00:00 2001 From: Marco Pivetta <ocramius@gmail.com> Date: Sat, 26 Nov 2016 06:02:16 +0100 Subject: [PATCH] #6110 split test into multiple sub-scenarios involving `PersistentCollection` key checking --- .../Tests/ORM/PersistentCollectionTest.php | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/PersistentCollectionTest.php b/tests/Doctrine/Tests/ORM/PersistentCollectionTest.php index 41ce2959c..df1a16867 100644 --- a/tests/Doctrine/Tests/ORM/PersistentCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/PersistentCollectionTest.php @@ -109,9 +109,9 @@ class PersistentCollectionTest extends OrmTestCase } /** - * Test that PersistentCollection::clear() clear elements, and reset keys + * @group 6110 */ - public function testClear() + public function testRemovingElementsAlsoRemovesKeys() { $this->setUpPersistentCollection(); @@ -120,12 +120,27 @@ class PersistentCollectionTest extends OrmTestCase $this->collection->removeElement('dummy'); $this->assertEquals([], array_keys($this->collection->toArray())); + } + + /** + * @group 6110 + */ + public function testClearWillAlsoClearKeys() + { + $this->setUpPersistentCollection(); $this->collection->add('dummy'); $this->collection->clear(); $this->assertEquals([], array_keys($this->collection->toArray())); + } + + /** + * @group 6110 + */ + public function testClearWillAlsoResetKeyPositions() + { + $this->setUpPersistentCollection(); - // test fix clear doesn't reset collection keys when collection is empty $this->collection->add('dummy'); $this->collection->removeElement('dummy'); $this->collection->clear();