Skip to content
Permalink
Browse files

Add tests for less greedy field parsing in SQLite.

Refs #6887
  • Loading branch information...
markstory committed Jun 26, 2015
1 parent 0b28c2e commit e651d15df594018eca7f626fb3ea39d085c5ce8a
Showing with 26 additions and 0 deletions.
  1. +26 −0 lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php
@@ -560,4 +560,30 @@ public function testFetchRowColumnParsing() {
$this->assertEquals($expected, $result);
}
/**
* Test parsing more complex field names.
*
* @return void
*/
public function testFetchColumnRowParsingMoreComplex()
{
$this->loadFixtures('User');
$sql = 'SELECT
COUNT(*) AS User__count,
COUNT(CASE id WHEN 2 THEN 1 ELSE NULL END) as User__case,
AVG(CAST("User"."id" AS BIGINT)) AS User__bigint
FROM "users" AS "User"
WHERE "User"."id" > 0';
$result = $this->Dbo->fetchRow($sql);
$expected = array(
'0' => array(
'User__count' => '4',
'User__case' => '1',
'User__bigint' => '2.5',
),
);
$this->assertEquals($expected, $result);
}
}

0 comments on commit e651d15

Please sign in to comment.
You can’t perform that action at this time.