diff options
author | Andrey Andreev <narf@devilix.net> | 2015-01-12 16:23:26 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2015-01-12 16:23:26 +0100 |
commit | 45a8afaabc6d09ad59bbb3c89a6cdfe8cbc3312c (patch) | |
tree | 7ca4207099f9225b5ef74b31f48627a282e7fdf2 /tests/mocks | |
parent | cd94dd7e1d8969658810ccc4158a75d2936d0a44 (diff) | |
parent | 934d6d9797f4dadd4e4d05b12bc4d7309fedb6c3 (diff) |
Merge branch 'develop' into feature/session
Diffstat (limited to 'tests/mocks')
-rw-r--r-- | tests/mocks/ci_testcase.php | 13 | ||||
-rw-r--r-- | tests/mocks/database/schema/skeleton.php | 34 |
2 files changed, 26 insertions, 21 deletions
diff --git a/tests/mocks/ci_testcase.php b/tests/mocks/ci_testcase.php index ad4fe5ac3..a2c37b92e 100644 --- a/tests/mocks/ci_testcase.php +++ b/tests/mocks/ci_testcase.php @@ -274,14 +274,14 @@ class CI_TestCase extends PHPUnit_Framework_TestCase { * @param string Path from base directory * @return bool TRUE on success, otherwise FALSE */ - public function ci_vfs_clone($path) + public function ci_vfs_clone($path, $dest='') { // Check for array if (is_array($path)) { foreach ($path as $file) { - $this->ci_vfs_clone($file); + $this->ci_vfs_clone($file, $dest); } return; } @@ -294,7 +294,12 @@ class CI_TestCase extends PHPUnit_Framework_TestCase { return FALSE; } - $this->ci_vfs_create(basename($path), $content, NULL, dirname($path)); + if (empty($dest)) + { + $dest = dirname($path); + } + + $this->ci_vfs_create(basename($path), $content, NULL, $dest); return TRUE; } @@ -378,4 +383,4 @@ class CI_TestCase extends PHPUnit_Framework_TestCase { } } -}
\ No newline at end of file +} diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php index e5c536090..b6d4b7893 100644 --- a/tests/mocks/database/schema/skeleton.php +++ b/tests/mocks/database/schema/skeleton.php @@ -22,7 +22,7 @@ class Mock_Database_Schema_Skeleton { */ public static function init($driver) { - if (empty(static::$db) && empty(static::$forge)) + if (empty(self::$db) && empty(self::$forge)) { $config = Mock_Database_DB::config($driver); $connection = new Mock_Database_DB($config); @@ -34,12 +34,12 @@ class Mock_Database_Schema_Skeleton { $loader->dbforge(); $forge = CI_TestCase::instance()->ci_instance_var('dbforge'); - static::$db = $db; - static::$forge = $forge; - static::$driver = $driver; + self::$db = $db; + self::$forge = $forge; + self::$driver = $driver; } - return static::$db; + return self::$db; } /** @@ -50,7 +50,7 @@ class Mock_Database_Schema_Skeleton { public static function create_tables() { // User Table - static::$forge->add_field(array( + self::$forge->add_field(array( 'id' => array( 'type' => 'INTEGER', 'constraint' => 3 @@ -68,11 +68,11 @@ class Mock_Database_Schema_Skeleton { 'constraint' => 40 ) )); - static::$forge->add_key('id', TRUE); - static::$forge->create_table('user', TRUE); + self::$forge->add_key('id', TRUE); + self::$forge->create_table('user', TRUE); // Job Table - static::$forge->add_field(array( + self::$forge->add_field(array( 'id' => array( 'type' => 'INTEGER', 'constraint' => 3 @@ -85,11 +85,11 @@ class Mock_Database_Schema_Skeleton { 'type' => 'TEXT' ) )); - static::$forge->add_key('id', TRUE); - static::$forge->create_table('job', TRUE); + self::$forge->add_key('id', TRUE); + self::$forge->create_table('job', TRUE); // Misc Table - static::$forge->add_field(array( + self::$forge->add_field(array( 'id' => array( 'type' => 'INTEGER', 'constraint' => 3 @@ -102,8 +102,8 @@ class Mock_Database_Schema_Skeleton { 'type' => 'TEXT' ) )); - static::$forge->add_key('id', TRUE); - static::$forge->create_table('misc', TRUE); + self::$forge->add_key('id', TRUE); + self::$forge->create_table('misc', TRUE); } /** @@ -136,13 +136,13 @@ class Mock_Database_Schema_Skeleton { foreach ($data as $table => $dummy_data) { - static::$db->truncate($table); + self::$db->truncate($table); foreach ($dummy_data as $single_dummy_data) { - static::$db->insert($table, $single_dummy_data); + self::$db->insert($table, $single_dummy_data); } } } -}
\ No newline at end of file +} |