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
7d5b7849
Commit
7d5b7849
authored
Jun 19, 2019
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revise variable names and error message in change stream examples
parent
a1852b20
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
DocumentationExamplesTest.php
tests/DocumentationExamplesTest.php
+8
-8
No files found.
tests/DocumentationExamplesTest.php
View file @
7d5b7849
...
...
@@ -954,11 +954,11 @@ class DocumentationExamplesTest extends FunctionalTestCase
$changeStream
->
next
();
$
next
Change
=
$changeStream
->
current
();
$
second
Change
=
$changeStream
->
current
();
// End Changestream Example 2
$this
->
assertNull
(
$firstChange
);
$this
->
assertNull
(
$
next
Change
);
$this
->
assertNull
(
$
second
Change
);
$insertManyResult
=
$db
->
inventory
->
insertMany
([
[
'_id'
=>
1
,
'x'
=>
'foo'
],
...
...
@@ -984,24 +984,24 @@ class DocumentationExamplesTest extends FunctionalTestCase
$resumeToken
=
(
$lastChange
!==
null
)
?
$lastChange
->
_id
:
null
;
if
(
$resumeToken
===
null
)
{
throw
new
\Exception
(
'
resumeT
oken was not found'
);
throw
new
\Exception
(
'
Resume t
oken was not found'
);
}
$changeStream
=
$db
->
inventory
->
watch
([],
[
'resumeAfter'
=>
$resumeToken
]);
$changeStream
->
rewind
();
$
nex
tChange
=
$changeStream
->
current
();
$
firs
tChange
=
$changeStream
->
current
();
// End Changestream Example 3
$expectedChange
=
[
'_id'
=>
$
nex
tChange
->
_id
,
'_id'
=>
$
firs
tChange
->
_id
,
'operationType'
=>
'insert'
,
'fullDocument'
=>
[
'_id'
=>
2
,
'x'
=>
'bar'
],
'ns'
=>
[
'db'
=>
$this
->
getDatabaseName
(),
'coll'
=>
'inventory'
],
'documentKey'
=>
[
'_id'
=>
2
],
];
$this
->
assertMatchesDocument
(
$expectedChange
,
$
nex
tChange
);
$this
->
assertMatchesDocument
(
$expectedChange
,
$
firs
tChange
);
// Start Changestream Example 4
$pipeline
=
[[
'$match'
=>
[
'$or'
=>
[[
'fullDocument.username'
=>
'alice'
],
[
'operationType'
=>
'delete'
]]]]];
...
...
@@ -1012,11 +1012,11 @@ class DocumentationExamplesTest extends FunctionalTestCase
$changeStream
->
next
();
$
next
Change
=
$changeStream
->
current
();
$
second
Change
=
$changeStream
->
current
();
// End Changestream Example 4
$this
->
assertNull
(
$firstChange
);
$this
->
assertNull
(
$
next
Change
);
$this
->
assertNull
(
$
second
Change
);
}
public
function
testAggregation_example_1
()
...
...
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