Commit c662aa19 authored by Jeremy Mikola's avatar Jeremy Mikola

Merge pull request #512

parents 72508634 aa1b9441
......@@ -8,17 +8,14 @@ use Exception;
class CachingIteratorTest extends TestCase
{
/**
* Sanity check for all following tests.
*
*/
public function testTraversingGeneratorConsumesIt()
{
$iterator = $this->getTraversable([1, 2, 3]);
$this->assertSame([1, 2, 3], iterator_to_array($iterator));
$this->expectException(Exception::class);
$this->expectExceptionMessage('Cannot traverse an already closed generator');
$this->assertSame([1, 2, 3], iterator_to_array($iterator));
iterator_to_array($iterator);
}
public function testConstructorRewinds()
......
......@@ -122,8 +122,9 @@ class CreateIndexesFunctionalTest extends FunctionalTestCase
];
$operation = new CreateIndexes($this->getDatabaseName(), $this->getCollectionName(), $indexes);
$this->expectException(RuntimeException::class);
$createdIndexNames = $operation->execute($this->getPrimaryServer());
$operation->execute($this->getPrimaryServer());
}
public function testDefaultWriteConcernIsOmitted()
......
......@@ -312,9 +312,6 @@ class WatchFunctionalTest extends FunctionalTestCase
{
$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);
$changeStream = $operation->execute($this->getPrimaryServer());
......@@ -322,6 +319,8 @@ class WatchFunctionalTest extends FunctionalTestCase
* that we test extraction functionality within next(). */
$this->insertDocument(['x' => 1]);
$this->expectException(ResumeTokenException::class);
$this->expectExceptionMessage('Resume token not found in change document');
$changeStream->next();
}
......@@ -329,14 +328,13 @@ class WatchFunctionalTest extends FunctionalTestCase
{
$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);
$changeStream = $operation->execute($this->getPrimaryServer());
$this->insertDocument(['x' => 1]);
$this->expectException(ResumeTokenException::class);
$this->expectExceptionMessage('Resume token not found in change document');
$changeStream->rewind();
}
......@@ -344,9 +342,6 @@ class WatchFunctionalTest extends FunctionalTestCase
{
$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);
$changeStream = $operation->execute($this->getPrimaryServer());
......@@ -354,6 +349,8 @@ class WatchFunctionalTest extends FunctionalTestCase
* that we test extraction functionality within next(). */
$this->insertDocument(['x' => 1]);
$this->expectException(ResumeTokenException::class);
$this->expectExceptionMessage('Expected resume token to have type "array or object" but found "string"');
$changeStream->next();
}
......@@ -361,14 +358,13 @@ class WatchFunctionalTest extends FunctionalTestCase
{
$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);
$changeStream = $operation->execute($this->getPrimaryServer());
$this->insertDocument(['x' => 1]);
$this->expectException(ResumeTokenException::class);
$this->expectExceptionMessage('Expected resume token to have type "array or object" but found "string"');
$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