From 96a4ca6605d6a8a94eea96ed00ab1cf31a8cdd35 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 23 Oct 2012 01:11:48 +0300 Subject: Add a test for issue #273 --- tests/codeigniter/database/query_builder/like_test.php | 16 ++++++++++++++++ tests/mocks/database/schema/skeleton.php | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/codeigniter/database/query_builder/like_test.php b/tests/codeigniter/database/query_builder/like_test.php index 5f3e52228..20ce5d99c 100644 --- a/tests/codeigniter/database/query_builder/like_test.php +++ b/tests/codeigniter/database/query_builder/like_test.php @@ -87,4 +87,20 @@ class Like_test extends CI_TestCase { $this->assertEquals('Musician', $jobs[2]['name']); } + // ------------------------------------------------------------------------ + + /** + * GitHub issue #273 + * + * @see ./mocks/schema/skeleton.php + */ + public function test_like_spaces_and_tabs() + { + $spaces = $this->db->like('key', ' ')->get('misc')->result_array(); + $tabs = $this->db->like('key', "\t")->get('misc')->result_array(); + + $this->assertEquals(1, count($spaces)); + $this->assertEquals(1, count($tabs)); + } + } \ No newline at end of file diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php index 18e1ddd4d..fb9aaefee 100644 --- a/tests/mocks/database/schema/skeleton.php +++ b/tests/mocks/database/schema/skeleton.php @@ -129,7 +129,8 @@ class Mock_Database_Schema_Skeleton { ), 'misc' => array( array('id' => 1, 'key' => '\\xxxfoo456', 'value' => 'Entry with \\xxx'), - array('id' => 2, 'key' => '\\%foo456', 'value' => 'Entry with \\%') + array('id' => 2, 'key' => '\\%foo456', 'value' => 'Entry with \\%'), + array('id' => 3, 'key' => ' One two three tab') ) ); -- cgit v1.2.3-24-g4f1b From 348bd1e2623ae13ef0dc576464d98eb3673ef15a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 23 Oct 2012 01:24:11 +0300 Subject: Fix a mock db entry --- tests/codeigniter/database/query_builder/like_test.php | 4 ++-- tests/mocks/database/schema/skeleton.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/codeigniter/database/query_builder/like_test.php b/tests/codeigniter/database/query_builder/like_test.php index 20ce5d99c..2736fbe0b 100644 --- a/tests/codeigniter/database/query_builder/like_test.php +++ b/tests/codeigniter/database/query_builder/like_test.php @@ -96,8 +96,8 @@ class Like_test extends CI_TestCase { */ public function test_like_spaces_and_tabs() { - $spaces = $this->db->like('key', ' ')->get('misc')->result_array(); - $tabs = $this->db->like('key', "\t")->get('misc')->result_array(); + $spaces = $this->db->like('value', ' ')->get('misc')->result_array(); + $tabs = $this->db->like('value', "\t")->get('misc')->result_array(); $this->assertEquals(1, count($spaces)); $this->assertEquals(1, count($tabs)); diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php index fb9aaefee..2226835c4 100644 --- a/tests/mocks/database/schema/skeleton.php +++ b/tests/mocks/database/schema/skeleton.php @@ -130,7 +130,7 @@ class Mock_Database_Schema_Skeleton { 'misc' => array( array('id' => 1, 'key' => '\\xxxfoo456', 'value' => 'Entry with \\xxx'), array('id' => 2, 'key' => '\\%foo456', 'value' => 'Entry with \\%'), - array('id' => 3, 'key' => ' One two three tab') + array('id' => 3, 'key' => 'spaces and tabs', 'value' => ' One two three tab') ) ); -- cgit v1.2.3-24-g4f1b From f5f898f8f30968fb36413a14de2dc6a4599b79a6 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 23 Oct 2012 02:13:29 +0300 Subject: Fix issue #779 --- tests/codeigniter/core/URI_test.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/codeigniter/core/URI_test.php b/tests/codeigniter/core/URI_test.php index 60ed1a4e9..e2deabe51 100644 --- a/tests/codeigniter/core/URI_test.php +++ b/tests/codeigniter/core/URI_test.php @@ -40,13 +40,13 @@ class URI_test extends CI_TestCase { '/index.php?/controller/method/?var=foo' => 'controller/method' ); - foreach($requests as $request => $expected) + foreach ($requests as $request => $expected) { $_SERVER['SCRIPT_NAME'] = '/index.php'; $_SERVER['REQUEST_URI'] = $request; $this->uri->_fetch_uri_string(); - $this->assertEquals($expected, $this->uri->uri_string ); + $this->assertEquals($expected, $this->uri->uri_string); } // Test a subfolder @@ -60,10 +60,10 @@ class URI_test extends CI_TestCase { unset($_SERVER['REQUEST_URI']); // life to path info - $_SERVER['PATH_INFO'] = $a = '/controller/method/'; + $_SERVER['PATH_INFO'] = '/controller/method/'; $this->uri->_fetch_uri_string(); - $this->assertEquals($a, $this->uri->uri_string); + $this->assertEquals('controller/method', $this->uri->uri_string); // death to path info // At this point your server must be seriously drunk @@ -72,7 +72,7 @@ class URI_test extends CI_TestCase { $_SERVER['QUERY_STRING'] = '/controller/method/'; $this->uri->_fetch_uri_string(); - $this->assertEquals($a, $this->uri->uri_string); + $this->assertEquals('controller/method', $this->uri->uri_string); // At this point your server is a labotomy victim unset($_SERVER['QUERY_STRING']); @@ -80,7 +80,7 @@ class URI_test extends CI_TestCase { $_GET['/controller/method/'] = ''; $this->uri->_fetch_uri_string(); - $this->assertEquals($a, $this->uri->uri_string); + $this->assertEquals('controller/method', $this->uri->uri_string); // Test coverage implies that these will work // uri_protocol: REQUEST_URI -- cgit v1.2.3-24-g4f1b