mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-09 21:12:41 +00:00
Merge branch 'master' into 2.6
This commit is contained in:
commit
decce4daf2
6 changed files with 140 additions and 91 deletions
|
@ -518,4 +518,46 @@ class SqliteTest extends CakeTestCase {
|
|||
$this->assertNotContains($scientificNotation, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that fields are parsed out in a reasonable fashion.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFetchRowColumnParsing() {
|
||||
$this->loadFixtures('User');
|
||||
$sql = 'SELECT "User"."id", "User"."user", "User"."password", "User"."created", (1 + 1) AS "two" ' .
|
||||
'FROM "users" AS "User" WHERE ' .
|
||||
'"User"."id" IN (SELECT MAX("id") FROM "users") ' .
|
||||
'OR "User.id" IN (5, 6, 7, 8)';
|
||||
$result = $this->Dbo->fetchRow($sql);
|
||||
|
||||
$expected = array(
|
||||
'User' => array(
|
||||
'id' => 4,
|
||||
'user' => 'garrett',
|
||||
'password' => '5f4dcc3b5aa765d61d8327deb882cf99',
|
||||
'created' => '2007-03-17 01:22:23'
|
||||
),
|
||||
0 => array(
|
||||
'two' => 2
|
||||
)
|
||||
);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$sql = 'SELECT "User"."id", "User"."user" ' .
|
||||
'FROM "users" AS "User" WHERE "User"."id" = 4 ' .
|
||||
'UNION ' .
|
||||
'SELECT "User"."id", "User"."user" ' .
|
||||
'FROM "users" AS "User" WHERE "User"."id" = 3';
|
||||
$result = $this->Dbo->fetchRow($sql);
|
||||
|
||||
$expected = array(
|
||||
'User' => array(
|
||||
'id' => 3,
|
||||
'user' => 'larry',
|
||||
),
|
||||
);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue