Commit d41c3f26 authored by Jeremy Mikola's avatar Jeremy Mikola

PHPLIB-96: Fix replacement/upsert test failures for 2.4

parent 362a27ff
...@@ -128,7 +128,8 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase ...@@ -128,7 +128,8 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
public function testFindOneAndReplaceWithUpsertWhenNoDocumentsMatchReturningDocumentBeforeModification() public function testFindOneAndReplaceWithUpsertWhenNoDocumentsMatchReturningDocumentBeforeModification()
{ {
$filter = array('_id' => 4); $filter = array('_id' => 4);
$replacement = array('x' => 44); // Server 2.4 and earlier requires any custom ID to also be in the replacement document
$replacement = array('_id' => 4, 'x' => 44);
$options = array( $options = array(
'projection' => array('x' => 1, '_id' => 0), 'projection' => array('x' => 1, '_id' => 0),
'sort' => array('x' => 1), 'sort' => array('x' => 1),
...@@ -173,7 +174,8 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase ...@@ -173,7 +174,8 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
public function testFindOneAndReplaceWithUpsertWhenNoDocumentsMatchReturningDocumentAfterModification() public function testFindOneAndReplaceWithUpsertWhenNoDocumentsMatchReturningDocumentAfterModification()
{ {
$filter = array('_id' => 4); $filter = array('_id' => 4);
$replacement = array('x' => 44); // Server 2.4 and earlier requires any custom ID to also be in the replacement document
$replacement = array('_id' => 4, 'x' => 44);
$options = array( $options = array(
'projection' => array('x' => 1, '_id' => 0), 'projection' => array('x' => 1, '_id' => 0),
'sort' => array('x' => 1), 'sort' => array('x' => 1),
......
...@@ -94,7 +94,8 @@ class ReplaceOneFunctionalTest extends FunctionalTestCase ...@@ -94,7 +94,8 @@ class ReplaceOneFunctionalTest extends FunctionalTestCase
public function testReplaceOneWithUpsertWhenNoDocumentsMatchWithoutAnIdSpecified() public function testReplaceOneWithUpsertWhenNoDocumentsMatchWithoutAnIdSpecified()
{ {
$filter = array('_id' => 4); $filter = array('_id' => 4);
$replacement = array('x' => 1); // Server 2.4 and earlier requires any custom ID to also be in the replacement document
$replacement = array('_id' => 4, 'x' => 1);
$options = array('upsert' => true); $options = array('upsert' => true);
$result = $this->collection->replaceOne($filter, $replacement, $options); $result = $this->collection->replaceOne($filter, $replacement, $options);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment