Commit a71ba94a authored by Jeremy Mikola's avatar Jeremy Mikola

Move expectException() closer to throwing method

parent 72508634
...@@ -312,9 +312,6 @@ class WatchFunctionalTest extends FunctionalTestCase ...@@ -312,9 +312,6 @@ class WatchFunctionalTest extends FunctionalTestCase
{ {
$pipeline = [['$project' => ['_id' => 0 ]]]; $pipeline = [['$project' => ['_id' => 0 ]]];
$this->expectException(ResumeTokenException::class);
$this->expectExceptionMessage('Resume token not found in change document');
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), $pipeline, $this->defaultOptions); $operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), $pipeline, $this->defaultOptions);
$changeStream = $operation->execute($this->getPrimaryServer()); $changeStream = $operation->execute($this->getPrimaryServer());
...@@ -322,6 +319,8 @@ class WatchFunctionalTest extends FunctionalTestCase ...@@ -322,6 +319,8 @@ class WatchFunctionalTest extends FunctionalTestCase
* that we test extraction functionality within next(). */ * that we test extraction functionality within next(). */
$this->insertDocument(['x' => 1]); $this->insertDocument(['x' => 1]);
$this->expectException(ResumeTokenException::class);
$this->expectExceptionMessage('Resume token not found in change document');
$changeStream->next(); $changeStream->next();
} }
...@@ -329,14 +328,13 @@ class WatchFunctionalTest extends FunctionalTestCase ...@@ -329,14 +328,13 @@ class WatchFunctionalTest extends FunctionalTestCase
{ {
$pipeline = [['$project' => ['_id' => 0 ]]]; $pipeline = [['$project' => ['_id' => 0 ]]];
$this->expectException(ResumeTokenException::class);
$this->expectExceptionMessage('Resume token not found in change document');
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), $pipeline, $this->defaultOptions); $operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), $pipeline, $this->defaultOptions);
$changeStream = $operation->execute($this->getPrimaryServer()); $changeStream = $operation->execute($this->getPrimaryServer());
$this->insertDocument(['x' => 1]); $this->insertDocument(['x' => 1]);
$this->expectException(ResumeTokenException::class);
$this->expectExceptionMessage('Resume token not found in change document');
$changeStream->rewind(); $changeStream->rewind();
} }
...@@ -344,9 +342,6 @@ class WatchFunctionalTest extends FunctionalTestCase ...@@ -344,9 +342,6 @@ class WatchFunctionalTest extends FunctionalTestCase
{ {
$pipeline = [['$project' => ['_id' => ['$literal' => 'foo']]]]; $pipeline = [['$project' => ['_id' => ['$literal' => 'foo']]]];
$this->expectException(ResumeTokenException::class);
$this->expectExceptionMessage('Expected resume token to have type "array or object" but found "string"');
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), $pipeline, $this->defaultOptions); $operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), $pipeline, $this->defaultOptions);
$changeStream = $operation->execute($this->getPrimaryServer()); $changeStream = $operation->execute($this->getPrimaryServer());
...@@ -354,6 +349,8 @@ class WatchFunctionalTest extends FunctionalTestCase ...@@ -354,6 +349,8 @@ class WatchFunctionalTest extends FunctionalTestCase
* that we test extraction functionality within next(). */ * that we test extraction functionality within next(). */
$this->insertDocument(['x' => 1]); $this->insertDocument(['x' => 1]);
$this->expectException(ResumeTokenException::class);
$this->expectExceptionMessage('Expected resume token to have type "array or object" but found "string"');
$changeStream->next(); $changeStream->next();
} }
...@@ -361,14 +358,13 @@ class WatchFunctionalTest extends FunctionalTestCase ...@@ -361,14 +358,13 @@ class WatchFunctionalTest extends FunctionalTestCase
{ {
$pipeline = [['$project' => ['_id' => ['$literal' => 'foo']]]]; $pipeline = [['$project' => ['_id' => ['$literal' => 'foo']]]];
$this->expectException(ResumeTokenException::class);
$this->expectExceptionMessage('Expected resume token to have type "array or object" but found "string"');
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), $pipeline, $this->defaultOptions); $operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), $pipeline, $this->defaultOptions);
$changeStream = $operation->execute($this->getPrimaryServer()); $changeStream = $operation->execute($this->getPrimaryServer());
$this->insertDocument(['x' => 1]); $this->insertDocument(['x' => 1]);
$this->expectException(ResumeTokenException::class);
$this->expectExceptionMessage('Expected resume token to have type "array or object" but found "string"');
$changeStream->rewind(); $changeStream->rewind();
} }
......
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