Commit a6af8a7e authored by Ian Jenkins's avatar Ian Jenkins

Add test case for iterating over results multiple times.

Test fails because it's not possible to reuse a generator in this way.
parent 149899ea
...@@ -866,6 +866,25 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -866,6 +866,25 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->markTestSkipped('Mysqli driver dont support this feature.'); $this->markTestSkipped('Mysqli driver dont support this feature.');
} }
} }
public function testIteratorCanBeIteratedMultipleTimes()
{
$sql = "SELECT test_int, test_string FROM fetch_table";
$stmt = $this->_conn->query($sql);
$stmt->setFetchMode(\PDO::FETCH_ASSOC);
$i = 0;
foreach ($stmt as $row) {
$i++;
}
$j = 0;
foreach ($stmt as $row) {
$j++;
}
$this->assertEquals($i, $j);
}
} }
class MyFetchClass class MyFetchClass
......
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