blob: 78587d2e92ab059f6f0e55bfd23bb003673dc4bc [file] [log] [blame]
Taufan Adityac0df5a22012-04-06 17:35:12 +07001<?php
2
3class Insert_test extends CI_TestCase {
4
5 /**
6 * @var object Database/Query Builder holder
Taufan Adityafc92fc22012-04-06 18:00:55 +07007 * @see ./mocks/schema/skeleton.php
Taufan Adityac0df5a22012-04-06 17:35:12 +07008 */
9 protected $db;
10
11 public function set_up()
12 {
13 $this->db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
14
15 Mock_Database_Schema_Skeleton::create_tables();
Taufan Adityafc92fc22012-04-06 18:00:55 +070016
17 // Truncate the current datas
18 $this->db->truncate('job');
Taufan Adityac0df5a22012-04-06 17:35:12 +070019 }
20
21 // ------------------------------------------------------------------------
22
23 /**
24 * @see ./mocks/schema/skeleton.php
25 */
26 public function test_insert()
27 {
Taufan Aditya81b6b5d2012-04-06 17:58:22 +070028 $job_data = array('id' => 1, 'name' => 'Grocery Sales', 'description' => 'Discount!');
Taufan Adityac0df5a22012-04-06 17:35:12 +070029
30 // Do normal insert
31 $this->assertTrue($this->db->insert('job', $job_data));
32 }
33
34 // ------------------------------------------------------------------------
35
36 /**
37 * @see ./mocks/schema/skeleton.php
38 */
39 public function test_insert_batch()
40 {
41 $job_datas = array(
Taufan Aditya81b6b5d2012-04-06 17:58:22 +070042 array('id' => 2, 'name' => 'Commedian', 'description' => 'Theres something in your teeth'),
43 array('id' => 3, 'name' => 'Cab Driver', 'description' => 'Iam yellow'),
Taufan Adityac0df5a22012-04-06 17:35:12 +070044 );
45
46 // Do insert batch
47 $this->assertTrue($this->db->insert_batch('job', $job_datas));
48 }
49
50}