Skip to content

Commit

Permalink
Regression test so that upserts never replace document data
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikola committed Feb 5, 2014
1 parent 374efd4 commit 67fa0c5
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ public function setUp()
$this->documentPersister = $this->uow->getDocumentPersister($this->class); $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() public function testLoadPreparesCriteriaAndSort()
{ {
$criteria = array('name' => array('$in' => array('a', 'b'))); $criteria = array('name' => array('$in' => array('a', 'b')));
Expand Down

0 comments on commit 67fa0c5

Please sign in to comment.