summaryrefslogtreecommitdiffstats
path: root/tests/mocks/core
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mocks/core')
-rw-r--r--tests/mocks/core/common.php26
-rw-r--r--tests/mocks/core/loader.php26
2 files changed, 29 insertions, 23 deletions
diff --git a/tests/mocks/core/common.php b/tests/mocks/core/common.php
index a655ee1db..b001074c8 100644
--- a/tests/mocks/core/common.php
+++ b/tests/mocks/core/common.php
@@ -39,6 +39,30 @@ if ( ! function_exists('config_item'))
}
}
+if ( ! function_exists('get_mimes'))
+{
+ /**
+ * Returns the MIME types array from config/mimes.php
+ *
+ * @return array
+ */
+ function &get_mimes()
+ {
+ static $_mimes = array();
+
+ if (empty($_mimes))
+ {
+ $path = realpath(PROJECT_BASE.'application/config/mimes.php');
+ if (is_file($path))
+ {
+ $_mimes = include($path);
+ }
+ }
+
+ return $_mimes;
+ }
+}
+
// --------------------------------------------------------------------
if ( ! function_exists('load_class'))
@@ -166,4 +190,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
index 53d88d55b..7ea4da369 100644
--- a/tests/mocks/core/loader.php
+++ b/tests/mocks/core/loader.php
@@ -3,29 +3,11 @@
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
- * in the application directory. this will give finer grained control over
- * these tests. So yeah, while this looks odd, I need to overwrite protected
- * class vars in the loader. So here we go...
- *
- * @covers CI_Loader::__construct()
+ * Give public access to _ci_autoloader for testing
*/
- public function __construct()
+ public function autoload()
{
- 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);
+ $this->_ci_autoloader();
}
-} \ No newline at end of file
+}