From df1577db0c519bdd5ce52113c1e0c9009205f929 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Fri, 18 Aug 2017 09:13:56 +0200 Subject: [PATCH] #5579 cleaning up test case, adding assertions critical to the understanding of the code --- tests/Doctrine/Tests/ORM/UnitOfWorkTest.php | 22 ++++++++++----------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php index 3af8fc5cd..d67525696 100644 --- a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php +++ b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php @@ -362,31 +362,29 @@ class UnitOfWorkTest extends OrmTestCase } /** - * @group 5579 + * @group #5579 */ - public function testEntityChangeSetNotClearAfterFlushOnEntityOrArrayOfEntity() + public function testEntityChangeSetIsNotClearedAfterFlushOnEntityOrArrayOfEntity() : void { - // Create and Set first entity $entity1 = new NotifyChangedEntity; - $entity1->setData('thedata'); - $this->_unitOfWork->persist($entity1); - - // Create and Set second entity $entity2 = new NotifyChangedEntity; + $entity3 = new NotifyChangedEntity; + + $entity1->setData('thedata'); $entity2->setData('thedata'); + $entity3->setData('thedata'); + + $this->_unitOfWork->persist($entity1); $this->_unitOfWork->persist($entity2); $this->_unitOfWork->commit($entity1); + $this->assertEmpty($this->_unitOfWork->getEntityChangeSet($entity1)); $this->assertCount(1, $this->_unitOfWork->getEntityChangeSet($entity2)); - // Create and Set third entity - $entity3 = new NotifyChangedEntity; - $entity3->setData('thedata'); $this->_unitOfWork->persist($entity3); - $this->_unitOfWork->commit([$entity1,$entity2]); + $this->_unitOfWork->commit([$entity1, $entity2]); $this->assertCount(1, $this->_unitOfWork->getEntityChangeSet($entity3)); - } /**