summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/database/query_builder
diff options
context:
space:
mode:
authorTaufan Aditya <toopay@taufanaditya.com>2012-05-04 19:42:02 +0200
committerTaufan Aditya <toopay@taufanaditya.com>2012-05-04 19:42:02 +0200
commitc386b2a363c289afcfa07eea081050e35c1e86d8 (patch)
tree2fd9517a49575b25accc355a7f50e100fb35a5f4 /tests/codeigniter/database/query_builder
parentbe6fb4271ce723376930507dbe534f91344f26c7 (diff)
count code-coverage
Diffstat (limited to 'tests/codeigniter/database/query_builder')
-rw-r--r--tests/codeigniter/database/query_builder/count_test.php44
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