Commit 76ef2717 authored by Katherine Walker's avatar Katherine Walker

Merge pull request #470

parents 7231d874 a46f70bf
......@@ -121,7 +121,7 @@ class MapReduce implements Executable
* applied to the returned Cursor (it is not sent to the server).
*
* * verbose (boolean): Specifies whether to include the timing information
* in the result information. The default is true.
* in the result information.
*
* * writeConcern (MongoDB\Driver\WriteConcern): Write concern. This only
* applies when results are output to a collection.
......@@ -143,10 +143,6 @@ class MapReduce implements Executable
throw InvalidArgumentException::invalidType('$out', $out, 'string or array or object');
}
$options += [
'verbose' => true,
];
if (isset($options['bypassDocumentValidation']) && ! is_bool($options['bypassDocumentValidation'])) {
throw InvalidArgumentException::invalidType('"bypassDocumentValidation" option', $options['bypassDocumentValidation'], 'boolean');
}
......
......@@ -201,7 +201,6 @@ class CollectionFunctionalTest extends FunctionalTestCase
$this->assertGreaterThanOrEqual(0, $result->getExecutionTimeMS());
$this->assertNotEmpty($result->getCounts());
$this->assertNotEmpty($result->getTiming());
}
/**
......
......@@ -90,6 +90,22 @@ class MapReduceFunctionalTest extends FunctionalTestCase
$operation = new MapReduce($this->getDatabaseName(), $this->getCollectionName(), $map, $reduce, $out);
$result = $operation->execute($this->getPrimaryServer());
$this->assertInstanceOf('MongoDB\MapReduceResult', $result);
$this->assertGreaterThanOrEqual(0, $result->getExecutionTimeMS());
$this->assertNotEmpty($result->getCounts());
}
public function testResultIncludesTimingWithVerboseOption()
{
$this->createFixtures(3);
$map = new Javascript('function() { emit(this.x, this.y); }');
$reduce = new Javascript('function(key, values) { return Array.sum(values); }');
$out = ['inline' => 1];
$operation = new MapReduce($this->getDatabaseName(), $this->getCollectionName(), $map, $reduce, $out, ['verbose' => true]);
$result = $operation->execute($this->getPrimaryServer());
$this->assertInstanceOf('MongoDB\MapReduceResult', $result);
$this->assertGreaterThanOrEqual(0, $result->getExecutionTimeMS());
$this->assertNotEmpty($result->getCounts());
......
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