1
0
mirror of synced 2025-02-02 13:31:45 +03:00

#6613 #6614 #6616 removing repeated PersistentCollectionTest chunks of code

This commit is contained in:
Marco Pivetta 2017-08-11 19:08:24 +02:00
parent d6bcb5b1f8
commit 61cb03bf30
No known key found for this signature in database
GPG Key ID: 4167D3337FD9D629

View File

@ -34,6 +34,8 @@ class PersistentCollectionTest extends OrmTestCase
parent::setUp(); parent::setUp();
$this->_emMock = EntityManagerMock::create(new ConnectionMock([], new DriverMock())); $this->_emMock = EntityManagerMock::create(new ConnectionMock([], new DriverMock()));
$this->setUpPersistentCollection();
} }
/** /**
@ -60,7 +62,6 @@ class PersistentCollectionTest extends OrmTestCase
*/ */
public function testCurrentInitializesCollection() public function testCurrentInitializesCollection()
{ {
$this->setUpPersistentCollection();
$this->collection->current(); $this->collection->current();
$this->assertTrue($this->collection->isInitialized()); $this->assertTrue($this->collection->isInitialized());
} }
@ -70,7 +71,6 @@ class PersistentCollectionTest extends OrmTestCase
*/ */
public function testKeyInitializesCollection() public function testKeyInitializesCollection()
{ {
$this->setUpPersistentCollection();
$this->collection->key(); $this->collection->key();
$this->assertTrue($this->collection->isInitialized()); $this->assertTrue($this->collection->isInitialized());
} }
@ -80,7 +80,6 @@ class PersistentCollectionTest extends OrmTestCase
*/ */
public function testNextInitializesCollection() public function testNextInitializesCollection()
{ {
$this->setUpPersistentCollection();
$this->collection->next(); $this->collection->next();
$this->assertTrue($this->collection->isInitialized()); $this->assertTrue($this->collection->isInitialized());
} }
@ -90,8 +89,6 @@ class PersistentCollectionTest extends OrmTestCase
*/ */
public function testRemovingElementsAlsoRemovesKeys() public function testRemovingElementsAlsoRemovesKeys()
{ {
$this->setUpPersistentCollection();
$dummy = new \stdClass(); $dummy = new \stdClass();
$this->collection->add($dummy); $this->collection->add($dummy);
@ -106,8 +103,6 @@ class PersistentCollectionTest extends OrmTestCase
*/ */
public function testClearWillAlsoClearKeys() public function testClearWillAlsoClearKeys()
{ {
$this->setUpPersistentCollection();
$this->collection->add(new \stdClass()); $this->collection->add(new \stdClass());
$this->collection->clear(); $this->collection->clear();
$this->assertEquals([], array_keys($this->collection->toArray())); $this->assertEquals([], array_keys($this->collection->toArray()));
@ -118,8 +113,6 @@ class PersistentCollectionTest extends OrmTestCase
*/ */
public function testClearWillAlsoResetKeyPositions() public function testClearWillAlsoResetKeyPositions()
{ {
$this->setUpPersistentCollection();
$dummy = new \stdClass(); $dummy = new \stdClass();
$this->collection->add($dummy); $this->collection->add($dummy);
@ -141,8 +134,6 @@ class PersistentCollectionTest extends OrmTestCase
$this->_emMock->setUnitOfWork($unitOfWork); $this->_emMock->setUnitOfWork($unitOfWork);
$this->setUpPersistentCollection();
$newElement = new \stdClass(); $newElement = new \stdClass();
$persistedElement = new \stdClass(); $persistedElement = new \stdClass();
@ -178,8 +169,6 @@ class PersistentCollectionTest extends OrmTestCase
$this->_emMock->setUnitOfWork($unitOfWork); $this->_emMock->setUnitOfWork($unitOfWork);
$this->setUpPersistentCollection();
$newElement = new \stdClass(); $newElement = new \stdClass();
$newElementThatIsAlsoPersisted = new \stdClass(); $newElementThatIsAlsoPersisted = new \stdClass();
$persistedElement = new \stdClass(); $persistedElement = new \stdClass();