diff options
author | Taufan Aditya <toopay@taufanaditya.com> | 2012-05-04 19:42:02 +0200 |
---|---|---|
committer | Taufan Aditya <toopay@taufanaditya.com> | 2012-05-04 19:42:02 +0200 |
commit | c386b2a363c289afcfa07eea081050e35c1e86d8 (patch) | |
tree | 2fd9517a49575b25accc355a7f50e100fb35a5f4 | |
parent | be6fb4271ce723376930507dbe534f91344f26c7 (diff) |
count code-coverage
-rw-r--r-- | tests/codeigniter/database/query_builder/count_test.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/codeigniter/database/query_builder/count_test.php b/tests/codeigniter/database/query_builder/count_test.php new file mode 100644 index 000000000..5e691692d --- /dev/null +++ b/tests/codeigniter/database/query_builder/count_test.php @@ -0,0 +1,44 @@ +<?php + +class Count_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_count_all() + { + $job_count = $this->db->count_all('job'); + + // Check the result + $this->assertEquals(4, $job_count); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_count_all_results() + { + $job_count = $this->db->like('name', 'ian') + ->count_all_results('job'); + + // Check the result + $this->assertEquals(2, $job_count); + } +}
\ No newline at end of file |