diff options
author | Taufan Aditya <toopay@taufanaditya.com> | 2012-05-04 14:22:48 +0200 |
---|---|---|
committer | Taufan Aditya <toopay@taufanaditya.com> | 2012-05-04 14:22:48 +0200 |
commit | 4e607b00b2c56b7fdcc5f1d1a290be2363c74a46 (patch) | |
tree | d280b20041e2de10a3779bde131963202d1c2757 | |
parent | f78018ec6b081518e4be24934448862a31bda9f8 (diff) |
GROUP BY clause API code-coverage
-rw-r--r-- | .travis.yml | 3 | ||||
-rw-r--r-- | tests/codeigniter/database/query_builder/group_test.php | 37 |
2 files changed, 39 insertions, 1 deletions
diff --git a/.travis.yml b/.travis.yml index 97ea0422d..971f62f38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,4 +25,5 @@ script: phpunit --configuration tests/travis/$DB.phpunit.xml branches: only: - develop - - master
\ No newline at end of file + - master + - db-tests
\ No newline at end of file diff --git a/tests/codeigniter/database/query_builder/group_test.php b/tests/codeigniter/database/query_builder/group_test.php new file mode 100644 index 000000000..ddb2d0d6a --- /dev/null +++ b/tests/codeigniter/database/query_builder/group_test.php @@ -0,0 +1,37 @@ +<?php + +class Group_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_group_by() + { + $jobs = $this->db->select('name') + ->from('job') + ->group_by('name HAVING SUM(id) > 2') + ->get() + ->result_array(); + + // Check the result + $this->assertEquals(2, count($jobs)); + $this->assertEquals('Accountant', $jobs[0]['name']); + $this->assertEquals('Musician', $jobs[1]['name']); + } + +}
\ No newline at end of file |