Browse Source

Fix error in cursor iterator behavior

Andreas Braun 10 years ago
parent
commit
8738430d14
1 changed files with 3 additions and 0 deletions
  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();
         $collection = $this->getCollection();
         $cursor = $collection->find(['foo' => 'bar']);
         $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');
         $this->assertTrue($cursor->valid(), 'Cursor should be valid');
 
 
         $item = $cursor->current();
         $item = $cursor->current();