Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-php-library
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
mongo-php-library
Commits
d41c3f26
Commit
d41c3f26
authored
Apr 30, 2015
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-96: Fix replacement/upsert test failures for 2.4
parent
362a27ff
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
FindOneAndReplaceFunctionalTest.php
...s/Collection/CrudSpec/FindOneAndReplaceFunctionalTest.php
+4
-2
ReplaceOneFunctionalTest.php
tests/Collection/CrudSpec/ReplaceOneFunctionalTest.php
+2
-1
No files found.
tests/Collection/CrudSpec/FindOneAndReplaceFunctionalTest.php
View file @
d41c3f26
...
@@ -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
),
...
...
tests/Collection/CrudSpec/ReplaceOneFunctionalTest.php
View file @
d41c3f26
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment