summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter
diff options
context:
space:
mode:
authorTaufan Aditya <toopay@taufanaditya.com>2012-03-28 10:15:30 +0200
committerTaufan Aditya <toopay@taufanaditya.com>2012-03-28 10:15:30 +0200
commitca16c4ff1aa0cf5ebfbe877e9be755c0b7d2061c (patch)
tree3d4fdf3ef62e215f2040992196bc041a91c97e90 /tests/codeigniter
parent67c287192b5ff414753ae50a834932f676a0db9e (diff)
Adding autoloader and mocks directory
Diffstat (limited to 'tests/codeigniter')
-rw-r--r--tests/codeigniter/core/Common_test.php2
-rw-r--r--tests/codeigniter/core/Loader_test.php38
-rw-r--r--tests/codeigniter/core/URI_test.php33
3 files changed, 2 insertions, 71 deletions
diff --git a/tests/codeigniter/core/Common_test.php b/tests/codeigniter/core/Common_test.php
index cec12982d..29b512d8a 100644
--- a/tests/codeigniter/core/Common_test.php
+++ b/tests/codeigniter/core/Common_test.php
@@ -1,7 +1,5 @@
<?php
-require_once(BASEPATH.'helpers/email_helper.php');
-
class Common_test extends CI_TestCase
{
diff --git a/tests/codeigniter/core/Loader_test.php b/tests/codeigniter/core/Loader_test.php
index b86fd3477..43008651e 100644
--- a/tests/codeigniter/core/Loader_test.php
+++ b/tests/codeigniter/core/Loader_test.php
@@ -1,38 +1,5 @@
<?php
-require_once 'vfsStream/vfsStream.php';
-require_once BASEPATH.'/core/Loader.php';
-
-class Extended_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);
- }
-}
-
-
class Loader_test extends CI_TestCase {
private $ci_obj;
@@ -40,7 +7,7 @@ class Loader_test extends CI_TestCase {
public function set_up()
{
// Instantiate a new loader
- $this->load = new Extended_Loader();
+ $this->load = new Mock_Core_Loader();
// mock up a ci instance
$this->ci_obj = new StdClass;
@@ -265,7 +232,4 @@ class Loader_test extends CI_TestCase {
// --------------------------------------------------------------------
-
-
-
}
diff --git a/tests/codeigniter/core/URI_test.php b/tests/codeigniter/core/URI_test.php
index 40252aa14..e340ddf73 100644
--- a/tests/codeigniter/core/URI_test.php
+++ b/tests/codeigniter/core/URI_test.php
@@ -1,41 +1,10 @@
<?php
-require BASEPATH.'core/URI.php';
-
-/**
- * Extend the URI class
- * - override contructor
- * - override CLI detection
- */
-class URI_extended extends CI_URI {
-
- public function __construct()
- {
- $test = CI_TestCase::instance();
- $cls =& $test->ci_core_class('cfg');
-
- // set predictable config values
- $test->ci_set_config(array(
- 'index_page' => 'index.php',
- 'base_url' => 'http://example.com/',
- 'subclass_prefix' => 'MY_'
- ));
-
- $this->config = new $cls;
-
- }
-
- protected function _is_cli_request()
- {
- return FALSE;
- }
-}
-
class URI_test extends CI_TestCase {
public function set_up()
{
- $this->uri = new URI_extended();
+ $this->uri = new Mock_Core_URI();
}
// --------------------------------------------------------------------