Commit 7d5b7849 authored by Jeremy Mikola's avatar Jeremy Mikola

Revise variable names and error message in change stream examples

parent a1852b20
......@@ -954,11 +954,11 @@ class DocumentationExamplesTest extends FunctionalTestCase
$changeStream->next();
$nextChange = $changeStream->current();
$secondChange = $changeStream->current();
// End Changestream Example 2
$this->assertNull($firstChange);
$this->assertNull($nextChange);
$this->assertNull($secondChange);
$insertManyResult = $db->inventory->insertMany([
['_id' => 1, 'x' => 'foo'],
......@@ -984,24 +984,24 @@ class DocumentationExamplesTest extends FunctionalTestCase
$resumeToken = ($lastChange !== null) ? $lastChange->_id : null;
if ($resumeToken === null) {
throw new \Exception('resumeToken was not found');
throw new \Exception('Resume token was not found');
}
$changeStream = $db->inventory->watch([], ['resumeAfter' => $resumeToken]);
$changeStream->rewind();
$nextChange = $changeStream->current();
$firstChange = $changeStream->current();
// End Changestream Example 3
$expectedChange = [
'_id' => $nextChange->_id,
'_id' => $firstChange->_id,
'operationType' => 'insert',
'fullDocument' => ['_id' => 2, 'x' => 'bar'],
'ns' => ['db' => $this->getDatabaseName(), 'coll' => 'inventory'],
'documentKey' => ['_id' => 2],
];
$this->assertMatchesDocument($expectedChange, $nextChange);
$this->assertMatchesDocument($expectedChange, $firstChange);
// Start Changestream Example 4
$pipeline = [['$match' => ['$or' => [['fullDocument.username' => 'alice'], ['operationType' => 'delete']]]]];
......@@ -1012,11 +1012,11 @@ class DocumentationExamplesTest extends FunctionalTestCase
$changeStream->next();
$nextChange = $changeStream->current();
$secondChange = $changeStream->current();
// End Changestream Example 4
$this->assertNull($firstChange);
$this->assertNull($nextChange);
$this->assertNull($secondChange);
}
public function testAggregation_example_1()
......
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