diff options
author | Taufan Aditya <toopay@taufanaditya.com> | 2012-05-04 10:05:22 +0200 |
---|---|---|
committer | Taufan Aditya <toopay@taufanaditya.com> | 2012-05-04 10:05:22 +0200 |
commit | d6b41bb2659f959da01aee0ddb38bb4bce6cd4b6 (patch) | |
tree | 781941ca709e2c40eab3a7191d5e42c558893580 /tests/codeigniter/database | |
parent | 17f799e1017d1688a2890a1ba78e4f53d80af77e (diff) |
JOIN clause API code-coverage
Diffstat (limited to 'tests/codeigniter/database')
-rw-r--r-- | tests/codeigniter/database/query_builder/join_test.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/codeigniter/database/query_builder/join_test.php b/tests/codeigniter/database/query_builder/join_test.php new file mode 100644 index 000000000..e05329d67 --- /dev/null +++ b/tests/codeigniter/database/query_builder/join_test.php @@ -0,0 +1,38 @@ +<?php + +class Join_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_join_simple() + { + $job_user = $this->db->select('job.id as job_id, job.name as job_name, user.id as user_id, user.name as user_name') + ->from('job') + ->join('user', 'user.id = job.id') + ->get() + ->result_array(); + + // Check the result + $this->assertEquals('1', $job_user[0]['job_id']); + $this->assertEquals('1', $job_user[0]['user_id']); + $this->assertEquals('Derek Jones', $job_user[0]['user_name']); + $this->assertEquals('Developer', $job_user[0]['job_name']); + } + +}
\ No newline at end of file |