Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Regression test so that upserts never replace document data

  • Loading branch information...
commit 67fa0c526f0a21bb57680ebb8e49699d44b3fcc2 1 parent 374efd4
Jeremy Mikola jmikola authored
15 tests/Doctrine/ODM/MongoDB/Tests/Functional/DocumentPersisterTest.php
View
@@ -26,6 +26,21 @@ public function setUp()
$this->documentPersister = $this->uow->getDocumentPersister($this->class);
}
+ public function testExecuteUpsertShouldNeverReplaceDocuments()
+ {
+ $originalData = $this->dm->getDocumentCollection($this->class)->findOne();
+
+ $document = new DocumentPersisterTestDocument();
+ $document->id = $originalData['_id'];
+
+ $this->dm->persist($document);
+ $this->dm->flush();
+
+ $updatedData = $this->dm->getDocumentCollection($this->class)->findOne(array('_id' => $originalData['_id']));
+
+ $this->assertEquals($originalData, $updatedData);
+ }
+
public function testLoadPreparesCriteriaAndSort()
{
$criteria = array('name' => array('$in' => array('a', 'b')));
Please sign in to comment.
Something went wrong with that request. Please try again.