From 9894dcb4b078f88945b6e5970fa2c5dc664d152d Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Sun, 27 Nov 2016 18:22:01 +0100 Subject: [PATCH] #6017 `clear($proxyClassName)` should behave like `clear($realClassName)` --- tests/Doctrine/Tests/ORM/UnitOfWorkTest.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php index ef321e761..acf256a96 100644 --- a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php +++ b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php @@ -373,6 +373,26 @@ class UnitOfWorkTest extends OrmTestCase $this->_unitOfWork->clear(uniqid('nonExisting', true)); } + /** + * @group 6017 + */ + public function testClearManagerWithProxyClassName() + { + $proxy = $this->_emMock->getReference(Country::class, ['id' => random_int(457, 100000)]); + + $entity = new Country(456, 'United Kingdom'); + + $this->_unitOfWork->persist($entity); + + $this->assertTrue($this->_unitOfWork->isInIdentityMap($entity)); + $this->assertTrue($this->_unitOfWork->isScheduledForInsert($entity)); + + $this->_unitOfWork->clear(get_class($proxy)); + + $this->assertFalse($this->_unitOfWork->isInIdentityMap($entity)); + $this->assertFalse($this->_unitOfWork->isScheduledForInsert($entity)); + } + /** * @group 6017 */