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
c662aa19
Commit
c662aa19
authored
Mar 13, 2018
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #512
parents
72508634
aa1b9441
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
18 deletions
+12
-18
CachingIteratorTest.php
tests/Model/CachingIteratorTest.php
+2
-5
CreateIndexesFunctionalTest.php
tests/Operation/CreateIndexesFunctionalTest.php
+2
-1
WatchFunctionalTest.php
tests/Operation/WatchFunctionalTest.php
+8
-12
No files found.
tests/Model/CachingIteratorTest.php
View file @
c662aa19
...
@@ -8,17 +8,14 @@ use Exception;
...
@@ -8,17 +8,14 @@ use Exception;
class
CachingIteratorTest
extends
TestCase
class
CachingIteratorTest
extends
TestCase
{
{
/**
* Sanity check for all following tests.
*
*/
public
function
testTraversingGeneratorConsumesIt
()
public
function
testTraversingGeneratorConsumesIt
()
{
{
$iterator
=
$this
->
getTraversable
([
1
,
2
,
3
]);
$iterator
=
$this
->
getTraversable
([
1
,
2
,
3
]);
$this
->
assertSame
([
1
,
2
,
3
],
iterator_to_array
(
$iterator
));
$this
->
assertSame
([
1
,
2
,
3
],
iterator_to_array
(
$iterator
));
$this
->
expectException
(
Exception
::
class
);
$this
->
expectException
(
Exception
::
class
);
$this
->
expectExceptionMessage
(
'Cannot traverse an already closed generator'
);
$this
->
expectExceptionMessage
(
'Cannot traverse an already closed generator'
);
$this
->
assertSame
([
1
,
2
,
3
],
iterator_to_array
(
$iterator
)
);
iterator_to_array
(
$iterator
);
}
}
public
function
testConstructorRewinds
()
public
function
testConstructorRewinds
()
...
...
tests/Operation/CreateIndexesFunctionalTest.php
View file @
c662aa19
...
@@ -122,8 +122,9 @@ class CreateIndexesFunctionalTest extends FunctionalTestCase
...
@@ -122,8 +122,9 @@ class CreateIndexesFunctionalTest extends FunctionalTestCase
];
];
$operation
=
new
CreateIndexes
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$indexes
);
$operation
=
new
CreateIndexes
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$indexes
);
$this
->
expectException
(
RuntimeException
::
class
);
$this
->
expectException
(
RuntimeException
::
class
);
$
createdIndexNames
=
$
operation
->
execute
(
$this
->
getPrimaryServer
());
$operation
->
execute
(
$this
->
getPrimaryServer
());
}
}
public
function
testDefaultWriteConcernIsOmitted
()
public
function
testDefaultWriteConcernIsOmitted
()
...
...
tests/Operation/WatchFunctionalTest.php
View file @
c662aa19
...
@@ -312,9 +312,6 @@ class WatchFunctionalTest extends FunctionalTestCase
...
@@ -312,9 +312,6 @@ class WatchFunctionalTest extends FunctionalTestCase
{
{
$pipeline
=
[[
'$project'
=>
[
'_id'
=>
0
]]];
$pipeline
=
[[
'$project'
=>
[
'_id'
=>
0
]]];
$this
->
expectException
(
ResumeTokenException
::
class
);
$this
->
expectExceptionMessage
(
'Resume token not found in change document'
);
$operation
=
new
Watch
(
$this
->
manager
,
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$pipeline
,
$this
->
defaultOptions
);
$operation
=
new
Watch
(
$this
->
manager
,
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$pipeline
,
$this
->
defaultOptions
);
$changeStream
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$changeStream
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
...
@@ -322,6 +319,8 @@ class WatchFunctionalTest extends FunctionalTestCase
...
@@ -322,6 +319,8 @@ class WatchFunctionalTest extends FunctionalTestCase
* that we test extraction functionality within next(). */
* that we test extraction functionality within next(). */
$this
->
insertDocument
([
'x'
=>
1
]);
$this
->
insertDocument
([
'x'
=>
1
]);
$this
->
expectException
(
ResumeTokenException
::
class
);
$this
->
expectExceptionMessage
(
'Resume token not found in change document'
);
$changeStream
->
next
();
$changeStream
->
next
();
}
}
...
@@ -329,14 +328,13 @@ class WatchFunctionalTest extends FunctionalTestCase
...
@@ -329,14 +328,13 @@ class WatchFunctionalTest extends FunctionalTestCase
{
{
$pipeline
=
[[
'$project'
=>
[
'_id'
=>
0
]]];
$pipeline
=
[[
'$project'
=>
[
'_id'
=>
0
]]];
$this
->
expectException
(
ResumeTokenException
::
class
);
$this
->
expectExceptionMessage
(
'Resume token not found in change document'
);
$operation
=
new
Watch
(
$this
->
manager
,
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$pipeline
,
$this
->
defaultOptions
);
$operation
=
new
Watch
(
$this
->
manager
,
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$pipeline
,
$this
->
defaultOptions
);
$changeStream
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$changeStream
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
insertDocument
([
'x'
=>
1
]);
$this
->
insertDocument
([
'x'
=>
1
]);
$this
->
expectException
(
ResumeTokenException
::
class
);
$this
->
expectExceptionMessage
(
'Resume token not found in change document'
);
$changeStream
->
rewind
();
$changeStream
->
rewind
();
}
}
...
@@ -344,9 +342,6 @@ class WatchFunctionalTest extends FunctionalTestCase
...
@@ -344,9 +342,6 @@ class WatchFunctionalTest extends FunctionalTestCase
{
{
$pipeline
=
[[
'$project'
=>
[
'_id'
=>
[
'$literal'
=>
'foo'
]]]];
$pipeline
=
[[
'$project'
=>
[
'_id'
=>
[
'$literal'
=>
'foo'
]]]];
$this
->
expectException
(
ResumeTokenException
::
class
);
$this
->
expectExceptionMessage
(
'Expected resume token to have type "array or object" but found "string"'
);
$operation
=
new
Watch
(
$this
->
manager
,
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$pipeline
,
$this
->
defaultOptions
);
$operation
=
new
Watch
(
$this
->
manager
,
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$pipeline
,
$this
->
defaultOptions
);
$changeStream
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$changeStream
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
...
@@ -354,6 +349,8 @@ class WatchFunctionalTest extends FunctionalTestCase
...
@@ -354,6 +349,8 @@ class WatchFunctionalTest extends FunctionalTestCase
* that we test extraction functionality within next(). */
* that we test extraction functionality within next(). */
$this
->
insertDocument
([
'x'
=>
1
]);
$this
->
insertDocument
([
'x'
=>
1
]);
$this
->
expectException
(
ResumeTokenException
::
class
);
$this
->
expectExceptionMessage
(
'Expected resume token to have type "array or object" but found "string"'
);
$changeStream
->
next
();
$changeStream
->
next
();
}
}
...
@@ -361,14 +358,13 @@ class WatchFunctionalTest extends FunctionalTestCase
...
@@ -361,14 +358,13 @@ class WatchFunctionalTest extends FunctionalTestCase
{
{
$pipeline
=
[[
'$project'
=>
[
'_id'
=>
[
'$literal'
=>
'foo'
]]]];
$pipeline
=
[[
'$project'
=>
[
'_id'
=>
[
'$literal'
=>
'foo'
]]]];
$this
->
expectException
(
ResumeTokenException
::
class
);
$this
->
expectExceptionMessage
(
'Expected resume token to have type "array or object" but found "string"'
);
$operation
=
new
Watch
(
$this
->
manager
,
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$pipeline
,
$this
->
defaultOptions
);
$operation
=
new
Watch
(
$this
->
manager
,
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$pipeline
,
$this
->
defaultOptions
);
$changeStream
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$changeStream
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
insertDocument
([
'x'
=>
1
]);
$this
->
insertDocument
([
'x'
=>
1
]);
$this
->
expectException
(
ResumeTokenException
::
class
);
$this
->
expectExceptionMessage
(
'Expected resume token to have type "array or object" but found "string"'
);
$changeStream
->
rewind
();
$changeStream
->
rewind
();
}
}
...
...
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