Added test case to #5008. Quoting numeric value 0 (zero)

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7302 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
renan.saddam 2008-06-30 13:44:16 +00:00
parent 90d243aabc
commit 88197569ad

View file

@ -2537,6 +2537,39 @@ class DboSourceTest extends CakeTestCase {
$result = $this->testDb->conditions( array(), true, false);
$this->assertPattern('/^\s*1\s*=\s*1\s*$/', $result);
}
/**
* testConditionsWithModel
*
* @access public
* @return void
*/
function testConditionsWithModel() {
$this->Model =& new Article2();
$result = $this->testDb->conditions(array('Article2.viewed >=' => 0), true, true, $this->Model);
$expected = " WHERE `Article2`.`viewed` >= 0";
$this->assertEqual($result, $expected);
$result = $this->testDb->conditions(array('Article2.viewed >=' => '0'), true, true, $this->Model);
$expected = " WHERE `Article2`.`viewed` >= 0";
$this->assertEqual($result, $expected);
$result = $this->testDb->conditions(array('Article2.viewed >=' => '1'), true, true, $this->Model);
$expected = " WHERE `Article2`.`viewed` >= 1";
$this->assertEqual($result, $expected);
$result = $this->testDb->conditions(array('Article2.rate_sum BETWEEN ? AND ?' => array(0, 10)), true, true, $this->Model);
$expected = " WHERE `Article2`.`rate_sum` BETWEEN 0 AND 10";
$this->assertEqual($result, $expected);
$result = $this->testDb->conditions(array('Article2.rate_sum BETWEEN ? AND ?' => array('0', '10')), true, true, $this->Model);
$expected = " WHERE `Article2`.`rate_sum` BETWEEN 0 AND 10";
$this->assertEqual($result, $expected);
$result = $this->testDb->conditions(array('Article2.rate_sum BETWEEN ? AND ?' => array('1', '10')), true, true, $this->Model);
$expected = " WHERE `Article2`.`rate_sum` BETWEEN 1 AND 10";
$this->assertEqual($result, $expected);
}
/**
* testFieldParsing method
*