1
0
mirror of synced 2025-02-21 22:53:15 +03:00

#1172 - covering also detached proxies - merging operations should not initialize either proxy

This commit is contained in:
Marco Pivetta 2015-01-16 21:14:13 +01:00
parent dde09872df
commit 0329ac5074

View File

@ -22,16 +22,35 @@ class MergeUninitializedProxyTest extends \Doctrine\Tests\OrmFunctionalTestCase
} }
} }
public function testMergeDetachedUnInitializedProxy()
{
$detachedUninitialized = $this->_em->getReference(MUPFile::CLASSNAME, 123);
$this->_em->clear();
$managed = $this->_em->getReference(MUPFile::CLASSNAME, 123);
$this->assertSame($managed, $this->_em->merge($detachedUninitialized));
$this->assertFalse($managed->__isInitialized());
$this->assertFalse($detachedUninitialized->__isInitialized());
}
public function testMergeUnserializedUnInitializedProxy() public function testMergeUnserializedUnInitializedProxy()
{ {
$detachedUninitialized = $this->_em->getReference(MUPFile::CLASSNAME, 123); $detachedUninitialized = $this->_em->getReference(MUPFile::CLASSNAME, 123);
$this->_em->clear(); $this->_em->clear();
$managed = $this->_em->getReference(MUPFile::CLASSNAME, 123);
$this->assertSame( $this->assertSame(
$this->_em->getReference(MUPFile::CLASSNAME, 123), $managed,
$this->_em->merge(unserialize(serialize($detachedUninitialized))) $this->_em->merge(unserialize(serialize($this->_em->merge($detachedUninitialized))))
); );
$this->assertFalse($managed->__isInitialized());
$this->assertFalse($detachedUninitialized->__isInitialized());
} }
public function testMergeUnserializedIntoEntity() { public function testMergeUnserializedIntoEntity() {