1
0
mirror of synced 2025-02-02 21:41:45 +03:00

Test Case for Clear entityInsertions for specific entityName

This commit is contained in:
Rico Humme 2016-06-03 16:13:52 +02:00 committed by Marco Pivetta
parent 70603ee3db
commit 3df494ddc8

View File

@ -323,6 +323,27 @@ class UnitOfWorkTest extends OrmTestCase
$this->assertTrue($this->_unitOfWork->isInIdentityMap($entity));
}
public function testPersistedEntityAndClearManager()
{
$entity1 = new ForumUser();
$entity1->id = 123;
$entity2 = new ForumAvatar();
$entity2->id = 456;
$this->_unitOfWork->persist($entity1);
$this->assertTrue($this->_unitOfWork->isInIdentityMap($entity1));
$this->_unitOfWork->persist($entity2);
$this->assertTrue($this->_unitOfWork->isInIdentityMap($entity2));
$this->_unitOfWork->clear(ForumAvatar::class);
$this->assertTrue($this->_unitOfWork->isInIdentityMap($entity1));
$this->assertFalse($this->_unitOfWork->isInIdentityMap($entity2));
$this->assertTrue($this->_unitOfWork->isScheduledForInsert($entity1));
$this->assertFalse($this->_unitOfWork->isScheduledForInsert($entity2));
}
/**
* Data Provider
*