From ef0bfea072a6b20e14cb6777c27b8b3a3d94ab5d Mon Sep 17 00:00:00 2001 From: tianhe1986 Date: Thu, 15 Jun 2017 11:47:28 +0800 Subject: Adding unit test. Signed-off-by: tianhe1986 --- tests/codeigniter/database/query_builder/count_test.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/codeigniter') diff --git a/tests/codeigniter/database/query_builder/count_test.php b/tests/codeigniter/database/query_builder/count_test.php index 90ac5283e..cce3fb61d 100644 --- a/tests/codeigniter/database/query_builder/count_test.php +++ b/tests/codeigniter/database/query_builder/count_test.php @@ -35,4 +35,14 @@ class Count_test extends CI_TestCase { $this->assertEquals(2, $this->db->like('name', 'ian')->count_all_results('job')); } + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_count_all_results_limit() + { + $this->assertEquals(2, $this->db->like('name', 'ian')->limit(10, 10)->count_all_results('job')); + } + } \ No newline at end of file -- cgit v1.2.3-24-g4f1b From bcd005fafa195d443db2419629bfeed99e49fc7e Mon Sep 17 00:00:00 2001 From: tianhe1986 Date: Thu, 15 Jun 2017 17:58:54 +0800 Subject: Getting right num of rows with LIMIT usage. Signed-off-by: tianhe1986 --- tests/codeigniter/database/query_builder/count_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/codeigniter') diff --git a/tests/codeigniter/database/query_builder/count_test.php b/tests/codeigniter/database/query_builder/count_test.php index cce3fb61d..da312d866 100644 --- a/tests/codeigniter/database/query_builder/count_test.php +++ b/tests/codeigniter/database/query_builder/count_test.php @@ -42,7 +42,7 @@ class Count_test extends CI_TestCase { */ public function test_count_all_results_limit() { - $this->assertEquals(2, $this->db->like('name', 'ian')->limit(10, 10)->count_all_results('job')); + $this->assertEquals(1, $this->db->like('name', 'ian')->limit(1)->count_all_results('job')); } } \ No newline at end of file -- cgit v1.2.3-24-g4f1b