diff options
author | Root <development@fractureme.com> | 2012-05-26 00:52:59 +0200 |
---|---|---|
committer | Root <development@fractureme.com> | 2012-05-26 00:52:59 +0200 |
commit | 99e602d25051ed449255fe16c4aa0aadd7d05c1f (patch) | |
tree | a0a9d0cdf4e741fcff68a2ecd70c198a43b5d787 /tests/codeigniter | |
parent | 35ac46d4aad12fe723229feca403b4dee3efcc27 (diff) | |
parent | f33e2ff30b0a9c54d6e8adbe88662838b9bd525e (diff) |
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into develop
Diffstat (limited to 'tests/codeigniter')
-rw-r--r-- | tests/codeigniter/database/DB_driver_test.php | 4 | ||||
-rw-r--r-- | tests/codeigniter/database/DB_test.php | 4 | ||||
-rw-r--r-- | tests/codeigniter/database/query_builder/escape_test.php | 54 |
3 files changed, 56 insertions, 6 deletions
diff --git a/tests/codeigniter/database/DB_driver_test.php b/tests/codeigniter/database/DB_driver_test.php index fb40f0608..9e16e29b4 100644 --- a/tests/codeigniter/database/DB_driver_test.php +++ b/tests/codeigniter/database/DB_driver_test.php @@ -2,8 +2,6 @@ class DB_driver_test extends CI_TestCase { - // ------------------------------------------------------------------------ - public function test_initialize() { $config = Mock_Database_DB::config(DB_DRIVER); @@ -32,5 +30,5 @@ class DB_driver_test extends CI_TestCase { { return new Mock_Database_Drivers_Postgre($config); } - + }
\ No newline at end of file diff --git a/tests/codeigniter/database/DB_test.php b/tests/codeigniter/database/DB_test.php index 9b93e223d..d5c0dea08 100644 --- a/tests/codeigniter/database/DB_test.php +++ b/tests/codeigniter/database/DB_test.php @@ -2,8 +2,6 @@ class DB_test extends CI_TestCase { - // ------------------------------------------------------------------------ - public function test_db_invalid() { $connection = new Mock_Database_DB(array( @@ -45,5 +43,5 @@ class DB_test extends CI_TestCase { $this->assertTrue($db instanceof CI_DB); $this->assertTrue($db instanceof CI_DB_Driver); } - + }
\ No newline at end of file diff --git a/tests/codeigniter/database/query_builder/escape_test.php b/tests/codeigniter/database/query_builder/escape_test.php new file mode 100644 index 000000000..50685922a --- /dev/null +++ b/tests/codeigniter/database/query_builder/escape_test.php @@ -0,0 +1,54 @@ +<?php + +class Escape_test extends CI_TestCase { + + /** + * @var object Database/Query Builder holder + */ + protected $db; + + public function set_up() + { + $this->db = Mock_Database_Schema_Skeleton::init(DB_DRIVER); + + Mock_Database_Schema_Skeleton::create_tables(); + Mock_Database_Schema_Skeleton::create_data(); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_escape_like_percent_sign() + { + $string = '\%foo' +; + $this->db->select('value'); + $this->db->from('misc'); + $this->db->like('key', $string, 'after'); + $res = $this->db->get(); + + // Check the result + $this->assertEquals(1, count($res->result_array())); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_escape_like_backslash_sign() + { + $string = '\\'; + + $this->db->select('value'); + $this->db->from('misc'); + $this->db->like('key', $string, 'after'); + $res = $this->db->get(); + + // Check the result + $this->assertEquals(2, count($res->result_array())); + } + +}
\ No newline at end of file |