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
fefdb978
Commit
fefdb978
authored
Feb 20, 2018
by
Katherine Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve ExplainTest and ExplainFunctionalTest
parent
c7b2b033
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
277 deletions
+60
-277
Explain.php
src/Operation/Explain.php
+4
-8
ExplainFunctionalTest.php
tests/Operation/ExplainFunctionalTest.php
+54
-257
ExplainTest.php
tests/Operation/ExplainTest.php
+2
-12
No files found.
src/Operation/Explain.php
View file @
fefdb978
...
@@ -80,16 +80,12 @@ class Explain implements Executable
...
@@ -80,16 +80,12 @@ class Explain implements Executable
throw
UnsupportedException
::
explainNotSupported
();
throw
UnsupportedException
::
explainNotSupported
();
}
}
if
(
$this
->
explainable
instanceOf
\MongoDB\Operation\Distinct
)
{
if
(
$this
->
explainable
instanceof
\MongoDB\Operation\Distinct
&&
!
\MongoDB\server_supports_feature
(
$server
,
self
::
$wireVersionForDistinct
))
{
if
(
!
\MongoDB\server_supports_feature
(
$server
,
self
::
$wireVersionForDistinct
))
{
throw
UnsupportedException
::
explainNotSupported
();
throw
UnsupportedException
::
explainNotSupported
();
}
}
}
if
(
$this
->
explainable
instanceOf
\MongoDB\Operation\FindAndModify
)
{
if
(
$this
->
explainable
instanceof
\MongoDB\Operation\FindAndModify
&&
!
\MongoDB\server_supports_feature
(
$server
,
self
::
$wireVersionForFindAndModify
))
{
if
(
!
\MongoDB\server_supports_feature
(
$server
,
self
::
$wireVersionForFindAndModify
))
{
throw
UnsupportedException
::
explainNotSupported
();
throw
UnsupportedException
::
explainNotSupported
();
}
}
}
$cmd
=
[
'explain'
=>
$this
->
explainable
->
getCommandDocument
()];
$cmd
=
[
'explain'
=>
$this
->
explainable
->
getCommandDocument
()];
...
...
tests/Operation/ExplainFunctionalTest.php
View file @
fefdb978
This diff is collapsed.
Click to expand it.
tests/Operation/ExplainTest.php
View file @
fefdb978
...
@@ -12,19 +12,9 @@ class ExplainTest extends TestCase
...
@@ -12,19 +12,9 @@ class ExplainTest extends TestCase
* @expectedException MongoDB\Exception\InvalidArgumentException
* @expectedException MongoDB\Exception\InvalidArgumentException
* @dataProvider provideInvalidConstructorOptions
* @dataProvider provideInvalidConstructorOptions
*/
*/
public
function
testConstructorOptionTypeChecks
ForCount
(
array
$options
)
public
function
testConstructorOptionTypeChecks
(
array
$options
)
{
{
$explainable
=
new
Count
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),[]);
$explainable
=
$this
->
createMock
(
'MongoDB\Operation\Explainable'
);
new
Explain
(
$this
->
getDatabaseName
(),
$explainable
,
$options
);
}
/**
* @expectedException MongoDB\Exception\InvalidArgumentException
* @dataProvider provideInvalidConstructorOptions
*/
public
function
testConstructorOptionTypeChecksForDistinct
(
array
$options
)
{
$explainable
=
new
Distinct
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
'x'
,
[]);
new
Explain
(
$this
->
getDatabaseName
(),
$explainable
,
$options
);
new
Explain
(
$this
->
getDatabaseName
(),
$explainable
,
$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