summaryrefslogtreecommitdiffstats
path: root/tests/mocks/core
diff options
context:
space:
mode:
authordchill42 <dchill42@gmail.com>2012-10-12 22:25:51 +0200
committerdchill42 <dchill42@gmail.com>2012-10-12 22:25:51 +0200
commit7ecc5cda6647a4b316b44dc40d5925d9ef63c908 (patch)
treee0d0e0c57bb911fc9690db4a85014b7a72e32300 /tests/mocks/core
parent2716398bd2f2ae36d7420c591fc759e0951ba0e2 (diff)
Integrated vfsStream better and made paths constants VFS-based
Signed-off-by: dchill42 <dchill42@gmail.com>
Diffstat (limited to 'tests/mocks/core')
-rw-r--r--tests/mocks/core/common.php26
-rw-r--r--tests/mocks/core/loader.php30
2 files changed, 25 insertions, 31 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 9eb78253b..7ea4da369 100644
--- a/tests/mocks/core/loader.php
+++ b/tests/mocks/core/loader.php
@@ -3,36 +3,6 @@
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. Also, by mocking the system directory, we eliminate dependency
- * on any other classes so errors in libraries, helpers, etc. don't give false
- * negatives for the actual loading process. So yeah, while this looks odd,
- * I need to overwrite protected class vars in the loader. So here we go...
- *
- * @covers CI_Loader::__construct()
- */
- public function __construct()
- {
- // Create VFS tree of loader locations
- $this->root = vfsStream::setup();
- $this->app_root = vfsStream::newDirectory('application')->at($this->root);
- $this->base_root = vfsStream::newDirectory('system')->at($this->root);
-
- // Get VFS app and base path URLs
- $this->app_path = vfsStream::url('application').'/';
- $this->base_path = vfsStream::url('system').'/';
-
- // Set loader paths with VFS URLs
- $this->_ci_ob_level = ob_get_level();
- $this->_ci_library_paths = array($this->app_path, $this->base_path);
- $this->_ci_helper_paths = array($this->app_path, $this->base_path);
- $this->_ci_model_paths = array($this->app_path);
- $this->_ci_view_paths = array($this->app_path.'views/' => TRUE);
- }
-
- /**
* Give public access to _ci_autoloader for testing
*/
public function autoload()