summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-06-09 22:34:21 +0200
committerAndrey Andreev <narf@bofh.bg>2012-06-09 22:34:21 +0200
commitf243ce13b4baf5bf8bebf36586514bb243dfc355 (patch)
tree6f9b26f7b1c82f50c0c9e4a1d0190b3398948da7 /tests
parentc186288755aba46a2b6f0c3f104d9a6ce6b11a7f (diff)
Cleanup/optimize tests/mocks/
Diffstat (limited to 'tests')
-rw-r--r--tests/mocks/autoloader.php4
-rw-r--r--tests/mocks/ci_testcase.php84
-rw-r--r--tests/mocks/core/common.php36
-rw-r--r--tests/mocks/core/input.php6
-rw-r--r--tests/mocks/core/loader.php7
-rw-r--r--tests/mocks/core/security.php2
-rw-r--r--tests/mocks/core/uri.php9
-rw-r--r--tests/mocks/core/utf8.php11
-rw-r--r--tests/mocks/database/config/mysql.php10
-rw-r--r--tests/mocks/database/config/pdo/mysql.php12
-rw-r--r--tests/mocks/database/config/pdo/pgsql.php12
-rw-r--r--tests/mocks/database/config/pdo/sqlite.php12
-rw-r--r--tests/mocks/database/config/pgsql.php10
-rw-r--r--tests/mocks/database/config/sqlite.php10
-rw-r--r--tests/mocks/database/db.php18
-rw-r--r--tests/mocks/database/db/driver.php7
-rw-r--r--tests/mocks/database/db/querybuilder.php9
-rw-r--r--tests/mocks/database/drivers/mysql.php9
-rw-r--r--tests/mocks/database/drivers/pdo.php8
-rw-r--r--tests/mocks/database/drivers/postgre.php9
-rw-r--r--tests/mocks/database/drivers/sqlite.php7
-rw-r--r--tests/mocks/database/schema/skeleton.php48
-rw-r--r--tests/mocks/libraries/encrypt.php21
-rw-r--r--tests/mocks/libraries/table.php3
24 files changed, 180 insertions, 184 deletions
diff --git a/tests/mocks/autoloader.php b/tests/mocks/autoloader.php
index 90aabcbe6..e3ff7a8bd 100644
--- a/tests/mocks/autoloader.php
+++ b/tests/mocks/autoloader.php
@@ -69,7 +69,7 @@ function autoload($class)
}
}
- $file = (isset($file)) ? $file : $dir.$class.'.php';
+ $file = isset($file) ? $file : $dir.$class.'.php';
if ( ! file_exists($file))
{
@@ -82,7 +82,7 @@ function autoload($class)
return FALSE;
}
- throw new InvalidArgumentException("Unable to load $class.");
+ throw new InvalidArgumentException("Unable to load {$class}.");
}
include_once($file);
diff --git a/tests/mocks/ci_testcase.php b/tests/mocks/ci_testcase.php
index f327e6b07..eda9e1b60 100644
--- a/tests/mocks/ci_testcase.php
+++ b/tests/mocks/ci_testcase.php
@@ -1,11 +1,11 @@
<?php
class CI_TestCase extends PHPUnit_Framework_TestCase {
-
+
protected $ci_config;
protected $ci_instance;
protected static $ci_test_instance;
-
+
private $global_map = array(
'benchmark' => 'bm',
'config' => 'cfg',
@@ -19,18 +19,17 @@ class CI_TestCase extends PHPUnit_Framework_TestCase {
'loader' => 'load',
'model' => 'model'
);
-
+
// --------------------------------------------------------------------
-
+
public function __construct()
{
parent::__construct();
-
$this->ci_config = array();
}
-
+
// --------------------------------------------------------------------
-
+
public function setUp()
{
if (method_exists($this, 'set_up'))
@@ -38,10 +37,10 @@ class CI_TestCase extends PHPUnit_Framework_TestCase {
$this->set_up();
}
}
-
+
// --------------------------------------------------------------------
-
- public function tearDown()
+
+ public function tearDown()
{
if (method_exists($this, 'tear_down'))
{
@@ -50,15 +49,15 @@ class CI_TestCase extends PHPUnit_Framework_TestCase {
}
// --------------------------------------------------------------------
-
+
public static function instance()
{
return self::$ci_test_instance;
}
-
+
// --------------------------------------------------------------------
-
- function ci_set_config($key, $val = '')
+
+ public function ci_set_config($key, $val = '')
{
if (is_array($key))
{
@@ -71,36 +70,36 @@ class CI_TestCase extends PHPUnit_Framework_TestCase {
}
// --------------------------------------------------------------------
-
- function ci_get_config()
+
+ public function ci_get_config()
{
return $this->ci_config;
}
-
+
// --------------------------------------------------------------------
-
- function ci_instance($obj = FALSE)
+
+ public function ci_instance($obj = FALSE)
{
if ( ! is_object($obj))
{
return $this->ci_instance;
}
-
+
$this->ci_instance = $obj;
}
-
+
// --------------------------------------------------------------------
-
- function ci_instance_var($name, $obj = FALSE)
+
+ public function ci_instance_var($name, $obj = FALSE)
{
if ( ! is_object($obj))
{
return $this->ci_instance->$name;
}
-
+
$this->ci_instance->$name =& $obj;
}
-
+
// --------------------------------------------------------------------
/**
@@ -112,10 +111,10 @@ class CI_TestCase extends PHPUnit_Framework_TestCase {
* test can modify the variable it assigns to and
* still maintain the global.
*/
- function &ci_core_class($name)
+ public function &ci_core_class($name)
{
$name = strtolower($name);
-
+
if (isset($this->global_map[$name]))
{
$class_name = ucfirst($name);
@@ -130,29 +129,29 @@ class CI_TestCase extends PHPUnit_Framework_TestCase {
{
throw new Exception('Not a valid core class.');
}
-
+
if ( ! class_exists('CI_'.$class_name))
{
require_once BASEPATH.'core/'.$class_name.'.php';
}
-
+
$GLOBALS[strtoupper($global_name)] = 'CI_'.$class_name;
return $GLOBALS[strtoupper($global_name)];
}
-
+
// --------------------------------------------------------------------
-
+
// convenience function for global mocks
- function ci_set_core_class($name, $obj)
+ public function ci_set_core_class($name, $obj)
{
$orig =& $this->ci_core_class($name);
$orig = $obj;
}
-
+
// --------------------------------------------------------------------
// Internals
// --------------------------------------------------------------------
-
+
/**
* Overwrite runBare
*
@@ -169,28 +168,27 @@ class CI_TestCase extends PHPUnit_Framework_TestCase {
}
// --------------------------------------------------------------------
-
- function helper($name)
+
+ public function helper($name)
{
require_once(BASEPATH.'helpers/'.$name.'_helper.php');
}
// --------------------------------------------------------------------
-
+
/**
* This overload is useful to create a stub, that need to have a specific method.
*/
- function __call($method, $args)
+ public function __call($method, $args)
{
- if ($this->{$method} instanceof Closure)
+ if ($this->{$method} instanceof Closure)
{
return call_user_func_array($this->{$method},$args);
- }
- else
+ }
+ else
{
return parent::__call($method, $args);
}
}
-}
-// EOF \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/mocks/core/common.php b/tests/mocks/core/common.php
index e1c493aa0..8466e47f8 100644
--- a/tests/mocks/core/common.php
+++ b/tests/mocks/core/common.php
@@ -4,11 +4,10 @@
if ( ! function_exists('get_instance'))
{
- function &get_instance()
+ function &get_instance()
{
$test = CI_TestCase::instance();
- $instance = $test->ci_instance();
- return $instance;
+ return $test->ci_instance();
}
}
@@ -16,11 +15,10 @@ if ( ! function_exists('get_instance'))
if ( ! function_exists('get_config'))
{
- function &get_config() {
+ function &get_config()
+ {
$test = CI_TestCase::instance();
- $config = $test->ci_get_config();
-
- return $config;
+ return $test->ci_get_config();
}
}
@@ -29,12 +27,12 @@ if ( ! function_exists('config_item'))
function config_item($item)
{
$config =& get_config();
-
+
if ( ! isset($config[$item]))
{
return FALSE;
}
-
+
return $config[$item];
}
}
@@ -49,16 +47,16 @@ if ( ! function_exists('load_class'))
{
throw new Exception('Not Implemented: Non-core load_class()');
}
-
+
$test = CI_TestCase::instance();
-
+
$obj =& $test->ci_core_class($class);
-
+
if (is_string($obj))
{
- throw new Exception('Bad Isolation: Use ci_set_core_class to set '.$class.'');
+ throw new Exception('Bad Isolation: Use ci_set_core_class to set '.$class);
}
-
+
return $obj;
}
}
@@ -74,16 +72,16 @@ if ( ! function_exists('remove_invisible_characters'))
function remove_invisible_characters($str, $url_encoded = TRUE)
{
$non_displayables = array();
-
+
// every control character except newline (dec 10)
// carriage return (dec 13), and horizontal tab (dec 09)
-
+
if ($url_encoded)
{
$non_displayables[] = '/%0[0-8bcef]/'; // url encoded 00-08, 11, 12, 14, 15
$non_displayables[] = '/%1[0-9a-f]/'; // url encoded 16-31
}
-
+
$non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127
do
@@ -166,6 +164,4 @@ if ( ! function_exists('set_status_header'))
{
return TRUE;
}
-}
-
-// EOF \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/mocks/core/input.php b/tests/mocks/core/input.php
index 8a337d2ef..2a4aa4997 100644
--- a/tests/mocks/core/input.php
+++ b/tests/mocks/core/input.php
@@ -1,10 +1,10 @@
<?php
class Mock_Core_Input extends CI_Input {
-
+
/**
- * Since we use GLOBAL to fetch Security and Utf8 classes,
- * we need to use inversion of control to mock up
+ * Since we use GLOBAL to fetch Security and Utf8 classes,
+ * we need to use inversion of control to mock up
* the same process within CI_Input class constructor.
*
* @covers CI_Input::__construct()
diff --git a/tests/mocks/core/loader.php b/tests/mocks/core/loader.php
index d4b29bb3d..53d88d55b 100644
--- a/tests/mocks/core/loader.php
+++ b/tests/mocks/core/loader.php
@@ -1,7 +1,7 @@
<?php
class Mock_Core_Loader extends CI_Loader {
-
+
/**
* Since we use paths to load up models, views, etc, we need the ability to
* mock up the file system so when core tests are run, we aren't mucking
@@ -15,16 +15,17 @@ class Mock_Core_Loader extends CI_Loader {
{
vfsStreamWrapper::register();
vfsStreamWrapper::setRoot(new vfsStreamDirectory('application'));
-
+
$this->models_dir = vfsStream::newDirectory('models')->at(vfsStreamWrapper::getRoot());
$this->libs_dir = vfsStream::newDirectory('libraries')->at(vfsStreamWrapper::getRoot());
$this->helpers_dir = vfsStream::newDirectory('helpers')->at(vfsStreamWrapper::getRoot());
$this->views_dir = vfsStream::newDirectory('views')->at(vfsStreamWrapper::getRoot());
-
+
$this->_ci_ob_level = ob_get_level();
$this->_ci_library_paths = array(vfsStream::url('application').'/', BASEPATH);
$this->_ci_helper_paths = array(vfsStream::url('application').'/', BASEPATH);
$this->_ci_model_paths = array(vfsStream::url('application').'/');
$this->_ci_view_paths = array(vfsStream::url('application').'/views/' => TRUE);
}
+
} \ No newline at end of file
diff --git a/tests/mocks/core/security.php b/tests/mocks/core/security.php
index d7ea0e6bd..e19a8b20b 100644
--- a/tests/mocks/core/security.php
+++ b/tests/mocks/core/security.php
@@ -1,7 +1,7 @@
<?php
class Mock_Core_Security extends CI_Security {
-
+
public function csrf_set_cookie()
{
// We cannot set cookie in CLI mode, so for csrf test, who rely on $_COOKIE,
diff --git a/tests/mocks/core/uri.php b/tests/mocks/core/uri.php
index b6946091e..94f75df64 100644
--- a/tests/mocks/core/uri.php
+++ b/tests/mocks/core/uri.php
@@ -1,12 +1,12 @@
<?php
class Mock_Core_URI extends CI_URI {
-
+
public function __construct()
{
$test = CI_TestCase::instance();
$cls =& $test->ci_core_class('cfg');
-
+
// set predictable config values
$test->ci_set_config(array(
'index_page' => 'index.php',
@@ -14,12 +14,13 @@ class Mock_Core_URI extends CI_URI {
'subclass_prefix' => 'MY_'
));
- $this->config = new $cls;
+ $this->config = new $cls;
}
-
+
protected function _is_cli_request()
{
return FALSE;
}
+
} \ No newline at end of file
diff --git a/tests/mocks/core/utf8.php b/tests/mocks/core/utf8.php
index b77d717e7..068e74ac1 100644
--- a/tests/mocks/core/utf8.php
+++ b/tests/mocks/core/utf8.php
@@ -1,27 +1,26 @@
<?php
class Mock_Core_Utf8 extends CI_Utf8 {
-
+
/**
- * We need to define several constants as
+ * We need to define several constants as
* the same process within CI_Utf8 class constructor.
*
* @covers CI_Utf8::__construct()
*/
public function __construct()
{
- defined('UTF8_ENABLED') or define('UTF8_ENABLED', TRUE);
+ defined('UTF8_ENABLED') OR define('UTF8_ENABLED', TRUE);
if (extension_loaded('mbstring'))
{
- defined('MB_ENABLED') or define('MB_ENABLED', TRUE);
+ defined('MB_ENABLED') OR define('MB_ENABLED', TRUE);
mb_internal_encoding('UTF-8');
}
else
{
- defined('MB_ENABLED') or define('MB_ENABLED', FALSE);
+ defined('MB_ENABLED') OR define('MB_ENABLED', FALSE);
}
-
}
} \ No newline at end of file
diff --git a/tests/mocks/database/config/mysql.php b/tests/mocks/database/config/mysql.php
index ace0a31b1..a590b9f53 100644
--- a/tests/mocks/database/config/mysql.php
+++ b/tests/mocks/database/config/mysql.php
@@ -1,7 +1,7 @@
<?php
return array(
-
+
// Typical Database configuration
'mysql' => array(
'dsn' => '',
@@ -9,7 +9,7 @@ return array(
'username' => 'travis',
'password' => '',
'database' => 'ci_test',
- 'dbdriver' => 'mysql',
+ 'dbdriver' => 'mysql'
),
// Database configuration with failover
@@ -28,7 +28,7 @@ return array(
'password' => '',
'database' => 'ci_test',
'dbdriver' => 'mysql',
- ),
- ),
- ),
+ )
+ )
+ )
); \ No newline at end of file
diff --git a/tests/mocks/database/config/pdo/mysql.php b/tests/mocks/database/config/pdo/mysql.php
index cefb6b008..fefe0d624 100644
--- a/tests/mocks/database/config/pdo/mysql.php
+++ b/tests/mocks/database/config/pdo/mysql.php
@@ -1,7 +1,7 @@
<?php
return array(
-
+
// Typical Database configuration
'pdo/mysql' => array(
'dsn' => '',
@@ -10,7 +10,7 @@ return array(
'password' => '',
'database' => 'ci_test',
'dbdriver' => 'pdo',
- 'pdodriver' => 'mysql',
+ 'pdodriver' => 'mysql'
),
// Database configuration with failover
@@ -30,8 +30,8 @@ return array(
'password' => '',
'database' => 'ci_test',
'dbdriver' => 'pdo',
- 'pdodriver' => 'mysql',
- ),
- ),
- ),
+ 'pdodriver' => 'mysql'
+ )
+ )
+ )
); \ No newline at end of file
diff --git a/tests/mocks/database/config/pdo/pgsql.php b/tests/mocks/database/config/pdo/pgsql.php
index 5196e9ad9..ddd638c8a 100644
--- a/tests/mocks/database/config/pdo/pgsql.php
+++ b/tests/mocks/database/config/pdo/pgsql.php
@@ -1,7 +1,7 @@
<?php
return array(
-
+
// Typical Database configuration
'pdo/pgsql' => array(
'dsn' => 'pgsql:host=localhost;port=5432;dbname=ci_test;',
@@ -10,7 +10,7 @@ return array(
'password' => '',
'database' => 'ci_test',
'dbdriver' => 'pdo',
- 'pdodriver' => 'pgsql',
+ 'pdodriver' => 'pgsql'
),
// Database configuration with failover
@@ -30,8 +30,8 @@ return array(
'password' => '',
'database' => 'ci_test',
'dbdriver' => 'pdo',
- 'pdodriver' => 'pgsql',
- ),
- ),
- ),
+ 'pdodriver' => 'pgsql'
+ )
+ )
+ )
); \ No newline at end of file
diff --git a/tests/mocks/database/config/pdo/sqlite.php b/tests/mocks/database/config/pdo/sqlite.php
index c68b4b213..36461843d 100644
--- a/tests/mocks/database/config/pdo/sqlite.php
+++ b/tests/mocks/database/config/pdo/sqlite.php
@@ -10,7 +10,7 @@ return array(
'password' => 'sqlite',
'database' => 'sqlite',
'dbdriver' => 'pdo',
- 'pdodriver' => 'sqlite',
+ 'pdodriver' => 'sqlite'
),
// Database configuration with failover
@@ -29,9 +29,9 @@ return array(
'username' => 'sqlite',
'password' => 'sqlite',
'database' => 'sqlite',
- 'dbdriver' => 'pdo',
- 'pdodriver' => 'sqlite',
- ),
- ),
- ),
+ 'dbdriver' => 'pdo',
+ 'pdodriver' => 'sqlite'
+ )
+ )
+ )
); \ No newline at end of file
diff --git a/tests/mocks/database/config/pgsql.php b/tests/mocks/database/config/pgsql.php
index c06af8ce0..1444b0066 100644
--- a/tests/mocks/database/config/pgsql.php
+++ b/tests/mocks/database/config/pgsql.php
@@ -1,7 +1,7 @@
<?php
return array(
-
+
// Typical Database configuration
'pgsql' => array(
'dsn' => '',
@@ -9,7 +9,7 @@ return array(
'username' => 'postgres',
'password' => '',
'database' => 'ci_test',
- 'dbdriver' => 'postgre',
+ 'dbdriver' => 'postgre'
),
// Database configuration with failover
@@ -28,7 +28,7 @@ return array(
'password' => '',
'database' => 'ci_test',
'dbdriver' => 'postgre',
- ),
- ),
- ),
+ )
+ )
+ )
); \ No newline at end of file
diff --git a/tests/mocks/database/config/sqlite.php b/tests/mocks/database/config/sqlite.php
index 755ce2a3a..d37ee4871 100644
--- a/tests/mocks/database/config/sqlite.php
+++ b/tests/mocks/database/config/sqlite.php
@@ -9,7 +9,7 @@ return array(
'username' => 'sqlite',
'password' => 'sqlite',
'database' => realpath(__DIR__.'/..').'/ci_test.sqlite',
- 'dbdriver' => 'sqlite3',
+ 'dbdriver' => 'sqlite3'
),
// Database configuration with failover
@@ -27,8 +27,8 @@ return array(
'username' => 'sqlite',
'password' => 'sqlite',
'database' => realpath(__DIR__.'/..').'/ci_test.sqlite',
- 'dbdriver' => 'sqlite3',
- ),
- ),
- ),
+ 'dbdriver' => 'sqlite3'
+ )
+ )
+ )
); \ No newline at end of file
diff --git a/tests/mocks/database/db.php b/tests/mocks/database/db.php
index 59028ed9c..30504bba6 100644
--- a/tests/mocks/database/db.php
+++ b/tests/mocks/database/db.php
@@ -6,7 +6,7 @@ class Mock_Database_DB {
* @var array DB configuration
*/
private $config = array();
-
+
/**
* Prepare database configuration skeleton
*
@@ -21,7 +21,7 @@ class Mock_Database_DB {
/**
* Build DSN connection string for DB driver instantiate process
*
- * @param string Group name
+ * @param string Group name
* @return string DSN Connection string
*/
public function set_dsn($group = 'default')
@@ -65,28 +65,27 @@ class Mock_Database_DB {
* Return a database config array
*
* @see ./config
- * @param string Driver based configuration
- * @return array
+ * @param string Driver based configuration
+ * @return array
*/
public static function config($driver)
{
$dir = realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR;
-
return include($dir.'config'.DIRECTORY_SEPARATOR.$driver.'.php');
}
/**
* Main DB method wrapper
*
- * @param string Group or DSN string
- * @param bool
- * @return object
+ * @param string Group or DSN string
+ * @param bool
+ * @return object
*/
public static function DB($group, $query_builder = FALSE)
{
include_once(BASEPATH.'database/DB.php');
- try
+ try
{
$db = DB($group, $query_builder);
}
@@ -97,4 +96,5 @@ class Mock_Database_DB {
return $db;
}
+
} \ No newline at end of file
diff --git a/tests/mocks/database/db/driver.php b/tests/mocks/database/db/driver.php
index cb1820277..65ac2c4cc 100644
--- a/tests/mocks/database/db/driver.php
+++ b/tests/mocks/database/db/driver.php
@@ -1,7 +1,7 @@
<?php
class Mock_Database_DB_Driver extends CI_DB_driver {
-
+
/**
* @var object The actual Driver
*/
@@ -16,7 +16,10 @@ class Mock_Database_DB_Driver extends CI_DB_driver {
*/
public function __construct($driver_class, $config = array())
{
- if (is_string($driver_class)) $this->ci_db_driver = new $driver_class($config);
+ if (is_string($driver_class))
+ {
+ $this->ci_db_driver = new $driver_class($config);
+ }
}
/**
diff --git a/tests/mocks/database/db/querybuilder.php b/tests/mocks/database/db/querybuilder.php
index 1b95c92af..3f2252622 100644
--- a/tests/mocks/database/db/querybuilder.php
+++ b/tests/mocks/database/db/querybuilder.php
@@ -1,10 +1,3 @@
<?php
-if ( ! class_exists('CI_DB_query_builder'))
-{
- class Mock_Database_DB_QueryBuilder extends CI_DB_active_record {}
-}
-else
-{
- class Mock_Database_DB_QueryBuilder extends CI_DB_query_builder {}
-}
+class Mock_Database_DB_QueryBuilder extends CI_DB_query_builder {} \ No newline at end of file
diff --git a/tests/mocks/database/drivers/mysql.php b/tests/mocks/database/drivers/mysql.php
index 34a74e2bf..e0c1fb06c 100644
--- a/tests/mocks/database/drivers/mysql.php
+++ b/tests/mocks/database/drivers/mysql.php
@@ -1,16 +1,17 @@
<?php
class Mock_Database_Drivers_Mysql extends Mock_Database_DB_Driver {
-
+
/**
* Instantiate the database driver
*
- * @param string DB Driver class name
- * @param array DB configuration to set
- * @return void
+ * @param string DB Driver class name
+ * @param array DB configuration to set
+ * @return void
*/
public function __construct($config = array())
{
parent::__construct('CI_DB_mysql_driver', $config);
}
+
} \ No newline at end of file
diff --git a/tests/mocks/database/drivers/pdo.php b/tests/mocks/database/drivers/pdo.php
index 590e19552..17768eed7 100644
--- a/tests/mocks/database/drivers/pdo.php
+++ b/tests/mocks/database/drivers/pdo.php
@@ -1,13 +1,13 @@
<?php
class Mock_Database_Drivers_PDO extends Mock_Database_DB_Driver {
-
+
/**
* Instantiate the database driver
*
- * @param string DB Driver class name
- * @param array DB configuration to set
- * @return void
+ * @param string DB Driver class name
+ * @param array DB configuration to set
+ * @return void
*/
public function __construct($config = array())
{
diff --git a/tests/mocks/database/drivers/postgre.php b/tests/mocks/database/drivers/postgre.php
index 0df905963..5a45115fa 100644
--- a/tests/mocks/database/drivers/postgre.php
+++ b/tests/mocks/database/drivers/postgre.php
@@ -1,16 +1,17 @@
<?php
class Mock_Database_Drivers_Postgre extends Mock_Database_DB_Driver {
-
+
/**
* Instantiate the database driver
*
- * @param string DB Driver class name
- * @param array DB configuration to set
- * @return void
+ * @param string DB Driver class name
+ * @param array DB configuration to set
+ * @return void
*/
public function __construct($config = array())
{
parent::__construct('CI_DB_postgre_driver', $config);
}
+
} \ No newline at end of file
diff --git a/tests/mocks/database/drivers/sqlite.php b/tests/mocks/database/drivers/sqlite.php
index 15cefbf53..512467520 100644
--- a/tests/mocks/database/drivers/sqlite.php
+++ b/tests/mocks/database/drivers/sqlite.php
@@ -5,12 +5,13 @@ class Mock_Database_Drivers_Sqlite extends Mock_Database_DB_Driver {
/**
* Instantiate the database driver
*
- * @param string DB Driver class name
- * @param array DB configuration to set
- * @return void
+ * @param string DB Driver class name
+ * @param array DB configuration to set
+ * @return void
*/
public function __construct($config = array())
{
parent::__construct('CI_DB_sqlite3_driver', $config);
}
+
} \ No newline at end of file
diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php
index 05499f82f..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,15 +75,15 @@ 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));
@@ -93,15 +92,15 @@ class Mock_Database_Schema_Skeleton {
static::$forge->add_field(array(
'id' => array(
'type' => 'INTEGER',
- 'constraint' => 3,
+ 'constraint' => 3
),
'key' => array(
'type' => 'VARCHAR',
- 'constraint' => 40,
+ 'constraint' => 40
),
'value' => array(
- 'type' => 'TEXT',
- ),
+ 'type' => 'TEXT'
+ )
));
static::$forge->add_key('id', TRUE);
static::$forge->create_table('misc', (strpos(static::$driver, 'pgsql') === FALSE));
@@ -120,28 +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 \\%'),
- ),
+ 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
diff --git a/tests/mocks/libraries/encrypt.php b/tests/mocks/libraries/encrypt.php
index a9bbaafdc..f1859398f 100644
--- a/tests/mocks/libraries/encrypt.php
+++ b/tests/mocks/libraries/encrypt.php
@@ -2,14 +2,15 @@
class Mock_Libraries_Encrypt extends CI_Encrypt {
- // Overide inaccesible protected method
- public function __call($method, $params)
- {
- if (is_callable(array($this, '_'.$method)))
- {
- return call_user_func_array(array($this, '_'.$method), $params);
- }
-
- throw new BadMethodCallException('Method '.$method.' was not found');
- }
+ // Overide inaccesible protected method
+ public function __call($method, $params)
+ {
+ if (is_callable(array($this, '_'.$method)))
+ {
+ return call_user_func_array(array($this, '_'.$method), $params);
+ }
+
+ throw new BadMethodCallException('Method '.$method.' was not found');
+ }
+
} \ No newline at end of file
diff --git a/tests/mocks/libraries/table.php b/tests/mocks/libraries/table.php
index 97fbb30bd..87c278bce 100644
--- a/tests/mocks/libraries/table.php
+++ b/tests/mocks/libraries/table.php
@@ -1,7 +1,7 @@
<?php
class Mock_Libraries_Table extends CI_Table {
-
+
// Overide inaccesible protected method
public function __call($method, $params)
{
@@ -12,4 +12,5 @@ class Mock_Libraries_Table extends CI_Table {
throw new BadMethodCallException('Method '.$method.' was not found');
}
+
} \ No newline at end of file