summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/database/query_builder
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-05-25 01:08:00 +0200
committerAndrey Andreev <narf@bofh.bg>2012-05-25 01:08:00 +0200
commit59d6b4fc4f4d7d5265b59cfd8c0f68f885083f69 (patch)
tree8ff0a9a543298dbff00c4b756676c7e25e7d9efa /tests/codeigniter/database/query_builder
parentee0f97ad35750c71e7888992b9084979059e831c (diff)
Alter LIKE escaping tests again
Diffstat (limited to 'tests/codeigniter/database/query_builder')
-rw-r--r--tests/codeigniter/database/query_builder/escape_test.php16
1 files changed, 6 insertions, 10 deletions
diff --git a/tests/codeigniter/database/query_builder/escape_test.php b/tests/codeigniter/database/query_builder/escape_test.php
index 5dd2da058..96fbd078b 100644
--- a/tests/codeigniter/database/query_builder/escape_test.php
+++ b/tests/codeigniter/database/query_builder/escape_test.php
@@ -23,13 +23,10 @@ class Escape_test extends CI_TestCase {
public function test_escape_like_percent_sign()
{
$string = $this->db->escape_like_str('\%foo');
- $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%'";
- $sql .= (strpos(DB_DRIVER, 'mysql') !== FALSE) ? ";" : "ESCAPE '!';";
+ $res = $this->db->select('value')->from('misc')->like('key', $string, 'after')->get();
- $res = $this->db->query($sql)->result_array();
-
// Check the result
- $this->assertEquals(1, count($res));
+ $this->assertEquals(1, count($res->result_array()));
}
// ------------------------------------------------------------------------
@@ -40,11 +37,10 @@ class Escape_test extends CI_TestCase {
public function test_escape_like_backslash_sign()
{
$string = $this->db->escape_like_str('\\');
- $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%'";
- $sql .= (strpos(DB_DRIVER, 'mysql') !== FALSE) ? ";" : "ESCAPE '!';";
- $res = $this->db->query($sql)->result_array();
-
+ $res = $this->db->select('value')->from('misc')->like('key', $string, 'after')->get();
+
// Check the result
- $this->assertEquals(2, count($res));
+ $this->assertEquals(2, count($res->result_array()));
}
+
} \ No newline at end of file