Commit 5e4b1a20 authored by Aigars Gedroics's avatar Aigars Gedroics

[DBAL-249] Created test for column fetch type.

parent 74c25001
......@@ -65,6 +65,15 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
}
$this->assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, \PDO::FETCH_BOTH);
}
public function testFetchColumn()
{
$expectedResult = array();
foreach ($this->expectedResult AS $v) {
$expectedResult[] = array_shift($v);
}
$this->assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, \PDO::FETCH_COLUMN);
}
public function testMixingFetch()
{
......@@ -180,7 +189,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
{
$data = array();
while ($row = $stmt->fetch($fetchStyle)) {
$data[] = array_change_key_case($row, CASE_LOWER);
$data[] = is_array($row) ? array_change_key_case($row, CASE_LOWER) : $row;
}
$stmt->closeCursor();
return $data;
......@@ -191,7 +200,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
$data = array();
$stmt->setFetchMode($fetchStyle);
foreach ($stmt as $row) {
$data[] = array_change_key_case($row, CASE_LOWER);
$data[] = is_array($row) ? array_change_key_case($row, CASE_LOWER) : $row;
}
$stmt->closeCursor();
return $data;
......
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