1
0
mirror of synced 2025-02-09 08:49:26 +03:00

#5579 cleaning up test case, adding assertions critical to the understanding of the code

This commit is contained in:
Marco Pivetta 2017-08-18 09:13:56 +02:00
parent 866a424963
commit df1577db0c
No known key found for this signature in database
GPG Key ID: 4167D3337FD9D629

View File

@ -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));
}
/**