blob: 115ccc3de3b640232069729d4fed6d4e493878a8 [file] [log] [blame]
Taufan Adityaca16c4f2012-03-28 15:15:30 +07001<?php
2
3require_once 'vfsStream/vfsStream.php';
4require_once BASEPATH.'/core/Loader.php';
5
6class Mock_Core_Loader extends CI_Loader {
7
8 /**
9 * Since we use paths to load up models, views, etc, we need the ability to
10 * mock up the file system so when core tests are run, we aren't mucking
11 * in the application directory. this will give finer grained control over
12 * these tests. So yeah, while this looks odd, I need to overwrite protected
13 * class vars in the loader. So here we go...
14 *
15 * @covers CI_Loader::__construct()
16 */
17 public function __construct()
18 {
19 vfsStreamWrapper::register();
20 vfsStreamWrapper::setRoot(new vfsStreamDirectory('application'));
21
22 $this->models_dir = vfsStream::newDirectory('models')->at(vfsStreamWrapper::getRoot());
23 $this->libs_dir = vfsStream::newDirectory('libraries')->at(vfsStreamWrapper::getRoot());
24 $this->helpers_dir = vfsStream::newDirectory('helpers')->at(vfsStreamWrapper::getRoot());
25 $this->views_dir = vfsStream::newDirectory('views')->at(vfsStreamWrapper::getRoot());
26
27 $this->_ci_ob_level = ob_get_level();
28 $this->_ci_library_paths = array(vfsStream::url('application').'/', BASEPATH);
29 $this->_ci_helper_paths = array(vfsStream::url('application').'/', BASEPATH);
30 $this->_ci_model_paths = array(vfsStream::url('application').'/');
31 $this->_ci_view_paths = array(vfsStream::url('application').'/views/' => TRUE);
32 }
33}