Skip to content

Commit a46f70b

Browse files
committed
Add testResultIncludesTimingWithVerboseOption()
1 parent ffc47d4 commit a46f70b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/Operation/MapReduceFunctionalTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,23 @@ public function testResult()
9595
$this->assertNotEmpty($result->getCounts());
9696
}
9797

98+
public function testResultIncludesTimingWithVerboseOption()
99+
{
100+
$this->createFixtures(3);
101+
102+
$map = new Javascript('function() { emit(this.x, this.y); }');
103+
$reduce = new Javascript('function(key, values) { return Array.sum(values); }');
104+
$out = ['inline' => 1];
105+
106+
$operation = new MapReduce($this->getDatabaseName(), $this->getCollectionName(), $map, $reduce, $out, ['verbose' => true]);
107+
$result = $operation->execute($this->getPrimaryServer());
108+
109+
$this->assertInstanceOf('MongoDB\MapReduceResult', $result);
110+
$this->assertGreaterThanOrEqual(0, $result->getExecutionTimeMS());
111+
$this->assertNotEmpty($result->getCounts());
112+
$this->assertNotEmpty($result->getTiming());
113+
}
114+
98115
public function testResultDoesNotIncludeTimingWithoutVerboseOption()
99116
{
100117
$this->createFixtures(3);

0 commit comments

Comments
 (0)