Просмотр исходного кода

Fix error in cursor iterator behavior

Andreas Braun 10 лет назад
Родитель
Сommit
8738430d14
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      tests/Alcaeus/MongoDbAdapter/MongoCursorTest.php

+ 3 - 0
tests/Alcaeus/MongoDbAdapter/MongoCursorTest.php

@@ -90,6 +90,9 @@ class MongoCursorTest extends TestCase
         $collection = $this->getCollection();
         $cursor = $collection->find(['foo' => 'bar']);
 
+        $this->assertFalse($cursor->valid(), 'Cursor should be invalid to start with');
+
+        $cursor->next();
         $this->assertTrue($cursor->valid(), 'Cursor should be valid');
 
         $item = $cursor->current();