summaryrefslogtreecommitdiffstats
path: root/tests/mocks/database/schema/skeleton.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-10-05 21:45:41 +0200
committerAndrey Andreev <narf@bofh.bg>2012-10-05 21:45:41 +0200
commit5b5021812ea6dc859312e00b6b0f078eea54c88d (patch)
tree0a8840ee0429cc405cb597438a73d03bca970c1a /tests/mocks/database/schema/skeleton.php
parent49d08053257b55db511eaca08b8ab5d12149f3b6 (diff)
parentdbad54e09a39a77c7404dee9ca1a6b34299469d0 (diff)
Merge upstream branch
Diffstat (limited to 'tests/mocks/database/schema/skeleton.php')
-rw-r--r--tests/mocks/database/schema/skeleton.php55
1 files changed, 38 insertions, 17 deletions
diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php
index 671336cc4..18e1ddd4d 100644
--- a/tests/mocks/database/schema/skeleton.php
+++ b/tests/mocks/database/schema/skeleton.php
@@ -41,8 +41,7 @@ class Mock_Database_Schema_Skeleton {
return static::$db;
}
-
-
+
/**
* Create the dummy tables
*
@@ -54,20 +53,20 @@ class Mock_Database_Schema_Skeleton {
static::$forge->add_field(array(
'id' => array(
'type' => 'INTEGER',
- 'constraint' => 3,
+ 'constraint' => 3
),
'name' => array(
'type' => 'VARCHAR',
- 'constraint' => 40,
+ 'constraint' => 40
),
'email' => array(
'type' => 'VARCHAR',
- 'constraint' => 100,
+ 'constraint' => 100
),
'country' => array(
'type' => 'VARCHAR',
- 'constraint' => 40,
- ),
+ 'constraint' => 40
+ )
));
static::$forge->add_key('id', TRUE);
static::$forge->create_table('user', (strpos(static::$driver, 'pgsql') === FALSE));
@@ -76,18 +75,35 @@ class Mock_Database_Schema_Skeleton {
static::$forge->add_field(array(
'id' => array(
'type' => 'INTEGER',
- 'constraint' => 3,
+ 'constraint' => 3
),
'name' => array(
'type' => 'VARCHAR',
- 'constraint' => 40,
+ 'constraint' => 40
),
'description' => array(
- 'type' => 'TEXT',
- ),
+ 'type' => 'TEXT'
+ )
));
static::$forge->add_key('id', TRUE);
static::$forge->create_table('job', (strpos(static::$driver, 'pgsql') === FALSE));
+
+ // Misc Table
+ static::$forge->add_field(array(
+ 'id' => array(
+ 'type' => 'INTEGER',
+ 'constraint' => 3
+ ),
+ 'key' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => 40
+ ),
+ 'value' => array(
+ 'type' => 'TEXT'
+ )
+ ));
+ static::$forge->add_key('id', TRUE);
+ static::$forge->create_table('misc', (strpos(static::$driver, 'pgsql') === FALSE));
}
/**
@@ -103,24 +119,29 @@ class Mock_Database_Schema_Skeleton {
array('id' => 1, 'name' => 'Derek Jones', 'email' => 'derek@world.com', 'country' => 'US'),
array('id' => 2, 'name' => 'Ahmadinejad', 'email' => 'ahmadinejad@world.com', 'country' => 'Iran'),
array('id' => 3, 'name' => 'Richard A Causey', 'email' => 'richard@world.com', 'country' => 'US'),
- array('id' => 4, 'name' => 'Chris Martin', 'email' => 'chris@world.com', 'country' => 'UK'),
+ array('id' => 4, 'name' => 'Chris Martin', 'email' => 'chris@world.com', 'country' => 'UK')
),
'job' => array(
- array('id' => 1, 'name' => 'Developer', 'description' => 'Awesome job, but sometimes makes you bored'),
+ 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'),
+ 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')
),
+ 'misc' => array(
+ array('id' => 1, 'key' => '\\xxxfoo456', 'value' => 'Entry with \\xxx'),
+ array('id' => 2, 'key' => '\\%foo456', 'value' => 'Entry with \\%')
+ )
);
- foreach ($data as $table => $dummy_data)
+ foreach ($data as $table => $dummy_data)
{
static::$db->truncate($table);
foreach ($dummy_data as $single_dummy_data)
{
- static::$db->insert($table, $single_dummy_data);
+ static::$db->insert($table, $single_dummy_data);
}
}
}
+
} \ No newline at end of file