From 5b421665bac7609192917f7b0f34838534be099e Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Thu, 5 Apr 2012 01:24:50 +0700 Subject: Simple query builder tests --- tests/mocks/database/schema/skeleton.php | 65 ++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 tests/mocks/database/schema/skeleton.php (limited to 'tests/mocks/database/schema') diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php new file mode 100644 index 000000000..bf9e75b45 --- /dev/null +++ b/tests/mocks/database/schema/skeleton.php @@ -0,0 +1,65 @@ +add_field(array( + 'id' => array( + 'type' => 'INT', + 'constraint' => 3, + ), + 'name' => array( + 'type' => 'VARCHAR', + 'constraint' => 40, + ), + 'description' => array( + 'type' => 'TEXT', + 'constraint' => 0, + ), + )); + $forge->add_key('id', TRUE); + $forge->create_table('job', TRUE); + } + + /** + * Create the dummy datas + * + * @return void + */ + public static function create_data($db) + { + // Job Data + $data = array( + 'job' => array( + array('id' => 1, 'name' => 'Developer', 'description' => 'Awesome job, but sometimes makes you bored'), + array('id' => 2, 'name' => 'Politician', 'description' => 'This is not really a job'), + array('id' => 3, 'name' => 'Accountant', 'description' => 'Boring job, but you will get free snack at lunch'), + array('id' => 4, 'name' => 'Musician', 'description' => 'Only Coldplay can actually called Musician'), + ), + ); + + foreach ($data as $table => $dummy_data) + { + $db->truncate($table); + + if (strpos(DB_DRIVER, 'sqlite') === FALSE) + { + $db->insert_batch($table, $dummy_data); + } + else + { + foreach ($dummy_data as $single_dummy_data) + { + $db->insert($table, $single_dummy_data); + } + } + } + } +} \ No newline at end of file -- cgit v1.2.3-24-g4f1b