summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/database
diff options
context:
space:
mode:
authorTaufan Aditya <toopay@taufanaditya.com>2012-05-03 07:14:19 +0200
committerTaufan Aditya <toopay@taufanaditya.com>2012-05-03 07:14:19 +0200
commit6e131cbd0a5243f29a5ad9f56c80715e534e4267 (patch)
treee8f07990078d3edd4be106a2a7d242bf955a6542 /tests/codeigniter/database
parent190c6bb125447f83793d9437f1bea28feada910a (diff)
FROM clause API code-coverage
Diffstat (limited to 'tests/codeigniter/database')
-rw-r--r--tests/codeigniter/database/query_builder/from_test.php51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/codeigniter/database/query_builder/from_test.php b/tests/codeigniter/database/query_builder/from_test.php
new file mode 100644
index 000000000..95ae4dfdb
--- /dev/null
+++ b/tests/codeigniter/database/query_builder/from_test.php
@@ -0,0 +1,51 @@
+<?php
+
+class From_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_from_simple()
+ {
+ $jobs = $this->db->from('job')
+ ->get()
+ ->result_array();
+
+ // Check items
+ $this->assertEquals(4, count($jobs));
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_from_with_where()
+ {
+ $job1 = $this->db->from('job')
+ ->where('id', 1)
+ ->get()
+ ->row();
+
+ // Check the result
+ $this->assertEquals('1', $job1->id);
+ $this->assertEquals('Developer', $job1->name);
+ $this->assertEquals('Awesome job, but sometimes makes you bored', $job1->description);
+ }
+
+} \ No newline at end of file