Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add tests for uncovered case of :0 replacements.

There were previously no tests for the :0, :1 style replacement markers
in DboSource. In fact I didn't even know it was a 'feature'.
  • Loading branch information...
commit 1daa27c0d7fb7b13bc178c189aac43240ea8d2a3 1 parent 1cb7e4f
@markstory markstory authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
View
19 lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
@@ -2507,6 +2507,25 @@ public function testArrayConditionsParsing() {
}
/**
+ * test conditions() with replacements.
+ *
+ * @return void
+ */
+ public function testConditionsWithReplacements() {
+ $result = $this->Dbo->conditions(array(
+ 'score BETWEEN :0 AND :1' => array(90.1, 95.7)
+ ));
+ $expected = " WHERE `score` BETWEEN 90.1 AND 95.7";
+ $this->assertEquals($expected, $result);
+
+ $result = $this->Dbo->conditions(array(
+ 'score BETWEEN ? AND ?' => array(90.1, 95.7)
+ ));
+ $expected = " WHERE `score` BETWEEN 90.1 AND 95.7";
+ $this->assertEquals($expected, $result);
+ }
+
+/**
* Test that array conditions with only one element work.
*
* @return void
Please sign in to comment.
Something went wrong with that request. Please try again.