summaryrefslogtreecommitdiffstats
path: root/tests/mocks/core/loader.php
diff options
context:
space:
mode:
authorIban Eguia <admin@razican.com>2012-06-08 23:01:31 +0200
committerIban Eguia <admin@razican.com>2012-06-08 23:01:31 +0200
commit895e98c0f04f1087e8900ce8423ad3210a423770 (patch)
tree6adfe487293df38807084599f1f04157b5531e54 /tests/mocks/core/loader.php
parent0ed4f63f4268b0c98f549ffd711702fd45a761d0 (diff)
parenta593c69de4ea125c096f611c78dd0839489e7ebd (diff)
Merge remote-tracking branch 'upstream/develop' into new_date
Diffstat (limited to 'tests/mocks/core/loader.php')
-rw-r--r--tests/mocks/core/loader.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/mocks/core/loader.php b/tests/mocks/core/loader.php
new file mode 100644
index 000000000..d4b29bb3d
--- /dev/null
+++ b/tests/mocks/core/loader.php
@@ -0,0 +1,30 @@
+<?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
+ * 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()
+ */
+ public function __construct()
+ {
+ 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