#1172 - removing redundant test logic
This commit is contained in:
parent
de4e980389
commit
438feccd55
@ -171,108 +171,6 @@ class MergeUninitializedProxyTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$logger2->queries,
|
$logger2->queries,
|
||||||
'No queries were executed on the second entity manager, as it is unrelated with the first proxy'
|
'No queries were executed on the second entity manager, as it is unrelated with the first proxy'
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testMergeDetachedIntoEntity() {
|
|
||||||
|
|
||||||
$file = new MUPFile;
|
|
||||||
|
|
||||||
$picture = new MUPPicture;
|
|
||||||
$picture->file = $file;
|
|
||||||
|
|
||||||
$em = $this->_em;
|
|
||||||
$em->persist($picture);
|
|
||||||
$em->flush();
|
|
||||||
$em->clear();
|
|
||||||
|
|
||||||
$fileId = $file->fileId;
|
|
||||||
$pictureId = $picture->pictureId;
|
|
||||||
|
|
||||||
$picture = $em->find(__NAMESPACE__ . '\MUPPicture', $pictureId);
|
|
||||||
|
|
||||||
$em->clear();
|
|
||||||
|
|
||||||
$file = $em->find(__NAMESPACE__ . '\MUPFile', $fileId);
|
|
||||||
|
|
||||||
$picture = $em->merge($picture);
|
|
||||||
|
|
||||||
$this->assertEquals($file, $picture->file, "Detached proxy was not merged into managed entity");
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testMergeUnserializedIntoProxy() {
|
|
||||||
|
|
||||||
$file = new MUPFile;
|
|
||||||
|
|
||||||
$picture = new MUPPicture;
|
|
||||||
$picture->file = $file;
|
|
||||||
|
|
||||||
$picture2 = new MUPPicture;
|
|
||||||
$picture2->file = $file;
|
|
||||||
|
|
||||||
$em = $this->_em;
|
|
||||||
$em->persist($picture);
|
|
||||||
$em->persist($picture2);
|
|
||||||
$em->flush();
|
|
||||||
$em->clear();
|
|
||||||
|
|
||||||
$pictureId = $picture->pictureId;
|
|
||||||
$picture2Id = $picture2->pictureId;
|
|
||||||
|
|
||||||
$picture = $em->find(__NAMESPACE__ . '\MUPPicture', $pictureId);
|
|
||||||
$serializedPicture = serialize($picture);
|
|
||||||
|
|
||||||
$em->clear();
|
|
||||||
|
|
||||||
$picture2 = $em->find(__NAMESPACE__ . '\MUPPicture', $picture2Id);
|
|
||||||
$this->assertFalse($picture->file->__isInitialized());
|
|
||||||
$picture = unserialize($serializedPicture);
|
|
||||||
|
|
||||||
$this->assertTrue($picture->file instanceof Proxy);
|
|
||||||
$this->assertFalse($picture->file->__isInitialized());
|
|
||||||
|
|
||||||
$picture = $em->merge($picture);
|
|
||||||
|
|
||||||
$this->assertTrue($picture->file instanceof Proxy);
|
|
||||||
$this->assertFalse($picture->file->__isInitialized(), 'Proxy has been initialized during merge.');
|
|
||||||
|
|
||||||
$this->assertEquals($picture2->file, $picture->file, "Unserialized proxy was not merged into managed proxy");
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testMergeDetachedIntoProxy() {
|
|
||||||
|
|
||||||
$file = new MUPFile;
|
|
||||||
|
|
||||||
$picture = new MUPPicture;
|
|
||||||
$picture->file = $file;
|
|
||||||
|
|
||||||
$picture2 = new MUPPicture;
|
|
||||||
$picture2->file = $file;
|
|
||||||
|
|
||||||
$em = $this->_em;
|
|
||||||
$em->persist($picture);
|
|
||||||
$em->persist($picture2);
|
|
||||||
$em->flush();
|
|
||||||
$em->clear();
|
|
||||||
|
|
||||||
$pictureId = $picture->pictureId;
|
|
||||||
$picture2Id = $picture2->pictureId;
|
|
||||||
|
|
||||||
$picture = $em->find(__NAMESPACE__ . '\MUPPicture', $pictureId);
|
|
||||||
|
|
||||||
$em->clear();
|
|
||||||
|
|
||||||
$picture2 = $em->find(__NAMESPACE__ . '\MUPPicture', $picture2Id);
|
|
||||||
|
|
||||||
$this->assertTrue($picture->file instanceof Proxy);
|
|
||||||
$this->assertFalse($picture->file->__isInitialized());
|
|
||||||
|
|
||||||
$picture = $em->merge($picture);
|
|
||||||
|
|
||||||
$this->assertTrue($picture->file instanceof Proxy);
|
|
||||||
$this->assertFalse($picture->file->__isInitialized(), 'Proxy has been initialized during merge.');
|
|
||||||
|
|
||||||
$this->assertEquals($picture2->file, $picture->file, "Detached proxy was not merged into managed proxy");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user