Unverified Commit 79e369e8 authored by roger.codina's avatar roger.codina Committed by Sergei Morozov

ResultCacheStatement lost its cache capability on fetchAll method

parent 125fb5e7
......@@ -166,7 +166,10 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement
*/
public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null)
{
return $this->statement->fetchAll($fetchMode, $fetchArgument, $ctorArgs);
$this->data = $this->statement->fetchAll($fetchMode, $fetchArgument, $ctorArgs);
$this->emptied = true;
return $this->data;
}
/**
......
......@@ -166,6 +166,16 @@ class ResultCacheTest extends DbalFunctionalTestCase
self::assertCount(2, $this->sqlLogger->queries);
}
public function testFetchAllAndFinishSavesCache()
{
$layerCache = new ArrayCache();
$stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'testcachekey', $layerCache));
$stmt->fetchAll();
$stmt->closeCursor();
self::assertCount(1, $layerCache->fetch('testcachekey'));
}
public function assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, $fetchMode)
{
$stmt = $this->connection->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
......
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