PHPLIB-515: Remove in-line mapReduce execution statistics

parent 4b5a0a19
......@@ -55,8 +55,8 @@ class MapReduceResult implements IteratorAggregate
public function __construct(callable $getIterator, stdClass $result)
{
$this->getIterator = $getIterator;
$this->executionTimeMS = (integer) $result->timeMillis;
$this->counts = (array) $result->counts;
$this->executionTimeMS = isset($result->timeMillis) ? (integer) $result->timeMillis : 0;
$this->counts = isset($result->counts) ? (array) $result->counts : [];
$this->timing = isset($result->timing) ? (array) $result->timing : [];
}
......
......@@ -396,9 +396,11 @@ class CollectionFunctionalTest extends FunctionalTestCase
$this->assertSameDocuments($expected, $result);
if (version_compare($this->getServerVersion(), '4.3.0', '<')) {
$this->assertGreaterThanOrEqual(0, $result->getExecutionTimeMS());
$this->assertNotEmpty($result->getCounts());
}
}
public function collectionMethodClosures()
{
......
......@@ -92,12 +92,19 @@ class MapReduceFunctionalTest extends FunctionalTestCase
$result = $operation->execute($this->getPrimaryServer());
$this->assertInstanceOf(MapReduceResult::class, $result);
if (version_compare($this->getServerVersion(), '4.3.0', '<')) {
$this->assertGreaterThanOrEqual(0, $result->getExecutionTimeMS());
$this->assertNotEmpty($result->getCounts());
}
}
public function testResultIncludesTimingWithVerboseOption()
{
if (version_compare($this->getServerVersion(), '4.3.0', '>=')) {
$this->markTestSkipped('mapReduce statistics are no longer exposed');
}
$this->createFixtures(3);
$map = new Javascript('function() { emit(this.x, this.y); }');
......@@ -115,6 +122,10 @@ class MapReduceFunctionalTest extends FunctionalTestCase
public function testResultDoesNotIncludeTimingWithoutVerboseOption()
{
if (version_compare($this->getServerVersion(), '4.3.0', '>=')) {
$this->markTestSkipped('mapReduce statistics are no longer exposed');
}
$this->createFixtures(3);
$map = new Javascript('function() { emit(this.x, this.y); }');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment