split test into multiple sub-scenarios involving PersistentCollection
key checking #6110
This commit is contained in:
parent
3dadfa49d5
commit
1486c8f8e2
@ -3,7 +3,6 @@
|
||||
namespace Doctrine\Tests\ORM;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\PersistentCollection;
|
||||
use Doctrine\Tests\Mocks\ConnectionMock;
|
||||
use Doctrine\Tests\Mocks\DriverMock;
|
||||
@ -85,9 +84,9 @@ class PersistentCollectionTest extends OrmTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that PersistentCollection::clear() clear elements, and reset keys
|
||||
* @group 6110
|
||||
*/
|
||||
public function testClear()
|
||||
public function testRemovingElementsAlsoRemovesKeys()
|
||||
{
|
||||
$this->setUpPersistentCollection();
|
||||
|
||||
@ -96,12 +95,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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user