summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/database/query_builder/count_test.php
diff options
context:
space:
mode:
authorTimothy Warren <tim@timshomepage.net>2012-05-16 21:39:14 +0200
committerTimothy Warren <tim@timshomepage.net>2012-05-16 21:39:14 +0200
commitf7f44584c7acb8be6097445529f09255bfe34e5d (patch)
treebb8760229e5113bca38d7505a475c1e6c62f2059 /tests/codeigniter/database/query_builder/count_test.php
parentcb6c34eb5839d2b9c8d8ce70dcddde8931c0c277 (diff)
parentc59e8720177d96a1dec1b2cbcd6296bbfceb4a2b (diff)
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into email
Diffstat (limited to 'tests/codeigniter/database/query_builder/count_test.php')
-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