From 4f42be55dc5ca3141f3d93f7f59989d3e52bc5a3 Mon Sep 17 00:00:00 2001 From: dchill42 Date: Sun, 21 Oct 2012 21:31:19 -0400 Subject: Raised CI_Loader test coverage to 93% Signed-off-by: dchill42 --- tests/mocks/ci_testcase.php | 1 + tests/mocks/ci_testconfig.php | 4 +++- tests/mocks/core/common.php | 7 ++++--- tests/mocks/core/loader.php | 13 ------------- tests/mocks/database/schema/skeleton.php | 2 +- 5 files changed, 9 insertions(+), 18 deletions(-) delete mode 100644 tests/mocks/core/loader.php (limited to 'tests/mocks') diff --git a/tests/mocks/ci_testcase.php b/tests/mocks/ci_testcase.php index e581d4b02..f16492945 100644 --- a/tests/mocks/ci_testcase.php +++ b/tests/mocks/ci_testcase.php @@ -38,6 +38,7 @@ class CI_TestCase extends PHPUnit_Framework_TestCase { $this->ci_vfs_root = vfsStream::setup(); $this->ci_app_root = vfsStream::newDirectory('application')->at($this->ci_vfs_root); $this->ci_base_root = vfsStream::newDirectory('system')->at($this->ci_vfs_root); + $this->ci_view_root = vfsStream::newDirectory('views')->at($this->ci_app_root); if (method_exists($this, 'set_up')) { diff --git a/tests/mocks/ci_testconfig.php b/tests/mocks/ci_testconfig.php index eb318ddeb..0c52bb984 100644 --- a/tests/mocks/ci_testconfig.php +++ b/tests/mocks/ci_testconfig.php @@ -4,14 +4,16 @@ class CI_TestConfig { public $config = array(); public $_config_paths = array(APPPATH); + public $loaded = array(); public function item($key) { return isset($this->config[$key]) ? $this->config[$key] : FALSE; } - public function load($arg1, $arg2, $arg3) + public function load($file, $arg2 = FALSE, $arg3 = FALSE) { + $this->loaded[] = $file; return TRUE; } diff --git a/tests/mocks/core/common.php b/tests/mocks/core/common.php index b001074c8..9289b2716 100644 --- a/tests/mocks/core/common.php +++ b/tests/mocks/core/common.php @@ -170,9 +170,10 @@ if ( ! function_exists('is_really_writable')) if ( ! function_exists('is_loaded')) { - function is_loaded() + function &is_loaded() { - throw new Exception('Bad Isolation: mock up environment'); + $loaded = array(); + return $loaded; } } @@ -190,4 +191,4 @@ if ( ! function_exists('set_status_header')) { return TRUE; } -} +} \ No newline at end of file diff --git a/tests/mocks/core/loader.php b/tests/mocks/core/loader.php deleted file mode 100644 index 7ea4da369..000000000 --- a/tests/mocks/core/loader.php +++ /dev/null @@ -1,13 +0,0 @@ -_ci_autoloader(); - } - -} diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php index 18e1ddd4d..69e3c187e 100644 --- a/tests/mocks/database/schema/skeleton.php +++ b/tests/mocks/database/schema/skeleton.php @@ -30,7 +30,7 @@ class Mock_Database_Schema_Skeleton { CI_TestCase::instance()->ci_instance_var('db', $db); - $loader = new Mock_Core_Loader(); + $loader = new CI_Loader(); $loader->dbforge(); $forge = CI_TestCase::instance()->ci_instance_var('dbforge'); -- cgit v1.2.3-24-g4f1b