diff options
author | Dan Bernardic <dan.bernardic@gmail.com> | 2015-01-12 05:01:23 +0100 |
---|---|---|
committer | Dan Bernardic <dan.bernardic@gmail.com> | 2015-01-12 05:01:23 +0100 |
commit | d24652d4ef8232fa6cfd675aa80d1e182073a220 (patch) | |
tree | 70b9b5f866af893022b314b75922678baf150b11 /tests | |
parent | 99f31e76bd06876cd3bf789f9d2774f79818b7df (diff) |
Added support for running unit tests on PHP 5.2
Signed-off-by: Dan Bernardic <dan.bernardic@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/codeigniter/core/Output_test.php | 23 | ||||
-rw-r--r-- | tests/mocks/database/schema/skeleton.php | 34 |
2 files changed, 29 insertions, 28 deletions
diff --git a/tests/codeigniter/core/Output_test.php b/tests/codeigniter/core/Output_test.php index a06c17045..887c077d7 100644 --- a/tests/codeigniter/core/Output_test.php +++ b/tests/codeigniter/core/Output_test.php @@ -3,19 +3,20 @@ class Output_test extends CI_TestCase { public $output; - protected $_output_data = <<<HTML -<html> - <head> - <title>Basic HTML</title> - </head> - <body> - Test - </body> -</html> -HTML; + protected $_output_data = ''; public function set_up() { + $this->_output_data =<<<HTML + <html> + <head> + <title>Basic HTML</title> + </head> + <body> + Test + </body> + </html> +HTML; $this->ci_set_config('charset', 'UTF-8'); $output = $this->ci_core_class('output'); $this->output = new $output(); @@ -59,4 +60,4 @@ HTML; ); } -}
\ 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 +} |