Added tests for issue #1100

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4811 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mariano.iglesias 2007-04-07 04:56:17 +00:00
parent 784ee985b5
commit 5e2d4167e3

View file

@ -1000,6 +1000,25 @@ class DboSourceTest extends UnitTestCase {
$expected = " WHERE DATEDIFF(NOW(),`Article`.`published`) < 1 && `Article`.`live`=1";
$this->assertEqual($result, $expected);
}
function testQuotesInStringConditions() {
$result = $this->db->conditions('Member.email = \'mariano@cricava.com\'');
$expected = ' WHERE `Member`.`email` = \'mariano@cricava.com\'';
$this->assertEqual($result, $expected);
$result = $this->db->conditions('Member.email = "mariano@cricava.com"');
$expected = ' WHERE `Member`.`email` = "mariano@cricava.com"';
$this->assertEqual($result, $expected);
$result = $this->db->conditions('Member.email = \'mariano@cricava.com\' AND Member.user LIKE \'mariano.iglesias%\'');
$expected = ' WHERE `Member`.`email` = \'mariano@cricava.com\' AND `Member`.`user` LIKE \'mariano.iglesias%\'';
$this->assertEqual($result, $expected);
$result = $this->db->conditions('Member.email = "mariano@cricava.com" AND Member.user LIKE "mariano.iglesias%"');
$expected = ' WHERE `Member`.`email` = "mariano@cricava.com" AND `Member`.`user` LIKE "mariano.iglesias%"';
$this->assertEqual($result, $expected);
}
function testArrayConditionsParsing() {
$result = $this->db->conditions(array('Candy.name' => 'LIKE a', 'HardCandy.name' => 'LIKE c'));