summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/database/query_builder/from_test.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codeigniter/database/query_builder/from_test.php')
-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