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
c9b4f244
Unverified
Commit
c9b4f244
authored
Feb 24, 2020
by
Andreas Braun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-515: Remove in-line mapReduce execution statistics
parent
4b5a0a19
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
6 deletions
+19
-6
MapReduceResult.php
src/MapReduceResult.php
+2
-2
CollectionFunctionalTest.php
tests/Collection/CollectionFunctionalTest.php
+4
-2
MapReduceFunctionalTest.php
tests/Operation/MapReduceFunctionalTest.php
+13
-2
No files found.
src/MapReduceResult.php
View file @
c9b4f244
...
@@ -55,8 +55,8 @@ class MapReduceResult implements IteratorAggregate
...
@@ -55,8 +55,8 @@ class MapReduceResult implements IteratorAggregate
public
function
__construct
(
callable
$getIterator
,
stdClass
$result
)
public
function
__construct
(
callable
$getIterator
,
stdClass
$result
)
{
{
$this
->
getIterator
=
$getIterator
;
$this
->
getIterator
=
$getIterator
;
$this
->
executionTimeMS
=
(
integer
)
$result
->
timeMillis
;
$this
->
executionTimeMS
=
isset
(
$result
->
timeMillis
)
?
(
integer
)
$result
->
timeMillis
:
0
;
$this
->
counts
=
(
array
)
$result
->
counts
;
$this
->
counts
=
isset
(
$result
->
counts
)
?
(
array
)
$result
->
counts
:
[]
;
$this
->
timing
=
isset
(
$result
->
timing
)
?
(
array
)
$result
->
timing
:
[];
$this
->
timing
=
isset
(
$result
->
timing
)
?
(
array
)
$result
->
timing
:
[];
}
}
...
...
tests/Collection/CollectionFunctionalTest.php
View file @
c9b4f244
...
@@ -396,8 +396,10 @@ class CollectionFunctionalTest extends FunctionalTestCase
...
@@ -396,8 +396,10 @@ class CollectionFunctionalTest extends FunctionalTestCase
$this
->
assertSameDocuments
(
$expected
,
$result
);
$this
->
assertSameDocuments
(
$expected
,
$result
);
$this
->
assertGreaterThanOrEqual
(
0
,
$result
->
getExecutionTimeMS
());
if
(
version_compare
(
$this
->
getServerVersion
(),
'4.3.0'
,
'<'
))
{
$this
->
assertNotEmpty
(
$result
->
getCounts
());
$this
->
assertGreaterThanOrEqual
(
0
,
$result
->
getExecutionTimeMS
());
$this
->
assertNotEmpty
(
$result
->
getCounts
());
}
}
}
public
function
collectionMethodClosures
()
public
function
collectionMethodClosures
()
...
...
tests/Operation/MapReduceFunctionalTest.php
View file @
c9b4f244
...
@@ -92,12 +92,19 @@ class MapReduceFunctionalTest extends FunctionalTestCase
...
@@ -92,12 +92,19 @@ class MapReduceFunctionalTest extends FunctionalTestCase
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
MapReduceResult
::
class
,
$result
);
$this
->
assertInstanceOf
(
MapReduceResult
::
class
,
$result
);
$this
->
assertGreaterThanOrEqual
(
0
,
$result
->
getExecutionTimeMS
());
$this
->
assertNotEmpty
(
$result
->
getCounts
());
if
(
version_compare
(
$this
->
getServerVersion
(),
'4.3.0'
,
'<'
))
{
$this
->
assertGreaterThanOrEqual
(
0
,
$result
->
getExecutionTimeMS
());
$this
->
assertNotEmpty
(
$result
->
getCounts
());
}
}
}
public
function
testResultIncludesTimingWithVerboseOption
()
public
function
testResultIncludesTimingWithVerboseOption
()
{
{
if
(
version_compare
(
$this
->
getServerVersion
(),
'4.3.0'
,
'>='
))
{
$this
->
markTestSkipped
(
'mapReduce statistics are no longer exposed'
);
}
$this
->
createFixtures
(
3
);
$this
->
createFixtures
(
3
);
$map
=
new
Javascript
(
'function() { emit(this.x, this.y); }'
);
$map
=
new
Javascript
(
'function() { emit(this.x, this.y); }'
);
...
@@ -115,6 +122,10 @@ class MapReduceFunctionalTest extends FunctionalTestCase
...
@@ -115,6 +122,10 @@ class MapReduceFunctionalTest extends FunctionalTestCase
public
function
testResultDoesNotIncludeTimingWithoutVerboseOption
()
public
function
testResultDoesNotIncludeTimingWithoutVerboseOption
()
{
{
if
(
version_compare
(
$this
->
getServerVersion
(),
'4.3.0'
,
'>='
))
{
$this
->
markTestSkipped
(
'mapReduce statistics are no longer exposed'
);
}
$this
->
createFixtures
(
3
);
$this
->
createFixtures
(
3
);
$map
=
new
Javascript
(
'function() { emit(this.x, this.y); }'
);
$map
=
new
Javascript
(
'function() { emit(this.x, this.y); }'
);
...
...
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