diff options
author | Andrey Andreev <narf@devilix.net> | 2017-02-21 10:39:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-21 10:39:45 +0100 |
commit | d785553f9a4f92bba3e3fe8c44ccc8d52d5d8f15 (patch) | |
tree | ccf0e8bbadcbdea3b2a2fb1c22b2dec95f308324 /tests/codeigniter | |
parent | 9bfa0cbcc8ac42a2295f25dd3d1ecc83fd7f458a (diff) | |
parent | 3e0ad435f13179ed1c590bdeba2fbeeaa7d0f9c2 (diff) |
Merge pull request #5017 from tianhe1986/develop_having_in
DB_query_builder: Adding having_in(), or_having_in(), having_not_in() and or_having_not_in()
Diffstat (limited to 'tests/codeigniter')
-rw-r--r-- | tests/codeigniter/database/query_builder/group_test.php | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/tests/codeigniter/database/query_builder/group_test.php b/tests/codeigniter/database/query_builder/group_test.php index 5249f7c87..51266e858 100644 --- a/tests/codeigniter/database/query_builder/group_test.php +++ b/tests/codeigniter/database/query_builder/group_test.php @@ -48,4 +48,74 @@ class Group_test extends CI_TestCase { $this->assertEquals(2, count($jobs)); } + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_having_in() + { + $jobs = $this->db->select('name') + ->from('job') + ->group_by('name') + ->having_in('SUM(id)', array(1, 2, 5)) + ->get() + ->result_array(); + + $this->assertEquals(2, count($jobs)); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_or_having_in() + { + $jobs = $this->db->select('name') + ->from('job') + ->group_by('name') + ->or_having_in('SUM(id)', array(1, 5)) + ->or_having_in('SUM(id)', array(2, 6)) + ->get() + ->result_array(); + + $this->assertEquals(2, count($jobs)); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_having_not_in() + { + $jobs = $this->db->select('name') + ->from('job') + ->group_by('name') + ->having_not_in('SUM(id)', array(3, 6)) + ->get() + ->result_array(); + + $this->assertEquals(3, count($jobs)); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_or_having_not_in() + { + $jobs = $this->db->select('name') + ->from('job') + ->group_by('name') + ->or_having_not_in('SUM(id)', array(1, 2, 3)) + ->or_having_not_in('SUM(id)', array(1, 3, 4)) + ->get() + ->result_array(); + + $this->assertEquals(2, count($jobs)); + } + }
\ No newline at end of file |