mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
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:
parent
90d243aabc
commit
88197569ad
1 changed files with 33 additions and 0 deletions
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue