diff options
author | Taufan Aditya <toopay@taufanaditya.com> | 2012-04-06 12:35:12 +0200 |
---|---|---|
committer | Taufan Aditya <toopay@taufanaditya.com> | 2012-04-06 12:35:12 +0200 |
commit | c0df5a231a28c6038f0a8ab702e090ce0e12b5a5 (patch) | |
tree | a295de51d2b7c92fc29f12e1acfcb2d548dd3982 /tests/codeigniter | |
parent | 57414b7ee33c8e3c6ee9fd2f63353bf9fa353651 (diff) |
Include insert test
Diffstat (limited to 'tests/codeigniter')
-rw-r--r-- | tests/codeigniter/database/query_builder/insert_test.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/codeigniter/database/query_builder/insert_test.php b/tests/codeigniter/database/query_builder/insert_test.php new file mode 100644 index 000000000..5607e8ce1 --- /dev/null +++ b/tests/codeigniter/database/query_builder/insert_test.php @@ -0,0 +1,47 @@ +<?php + +class Insert_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_insert() + { + $job_data = array('name' => 'Grocery Sales', 'description' => 'Discount!'); + + // Do normal insert + $this->assertTrue($this->db->insert('job', $job_data)); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_insert_batch() + { + $job_datas = array( + array('name' => 'Commedian', 'description' => 'Theres something in your teeth'), + array('name' => 'Cab Driver', 'description' => 'Iam yellow'), + ); + + // Do insert batch + $this->assertTrue($this->db->insert_batch('job', $job_datas)); + } + +}
\ No newline at end of file |