diff options
author | Taufan Aditya <toopay@taufanaditya.com> | 2012-03-28 10:15:30 +0200 |
---|---|---|
committer | Taufan Aditya <toopay@taufanaditya.com> | 2012-03-28 10:15:30 +0200 |
commit | ca16c4ff1aa0cf5ebfbe877e9be755c0b7d2061c (patch) | |
tree | 3d4fdf3ef62e215f2040992196bc041a91c97e90 /tests/mocks/core/loader.php | |
parent | 67c287192b5ff414753ae50a834932f676a0db9e (diff) |
Adding autoloader and mocks directory
Diffstat (limited to 'tests/mocks/core/loader.php')
-rw-r--r-- | tests/mocks/core/loader.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/mocks/core/loader.php b/tests/mocks/core/loader.php new file mode 100644 index 000000000..115ccc3de --- /dev/null +++ b/tests/mocks/core/loader.php @@ -0,0 +1,33 @@ +<?php + +require_once 'vfsStream/vfsStream.php'; +require_once BASEPATH.'/core/Loader.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 |