summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/codeigniter/libraries/Session_test.php17
-rw-r--r--tests/mocks/core/input.php10
2 files changed, 16 insertions, 11 deletions
diff --git a/tests/codeigniter/libraries/Session_test.php b/tests/codeigniter/libraries/Session_test.php
index 135f71806..60d3a5b30 100644
--- a/tests/codeigniter/libraries/Session_test.php
+++ b/tests/codeigniter/libraries/Session_test.php
@@ -30,15 +30,11 @@ class Session_test extends CI_TestCase {
// Establish necessary support classes
$obj = new stdClass;
- $classes = array(
- 'config' => 'cfg',
- 'load' => 'load',
- 'input' => 'in'
- );
- foreach ($classes as $name => $abbr) {
- $class = $this->ci_core_class($abbr);
- $obj->$name = new $class;
- }
+ $cfg = $this->ci_core_class('cfg');
+ $obj->config = new $cfg();
+ $ldr = $this->ci_core_class('load');
+ $obj->load = new $ldr();
+ $obj->input = new Mock_Core_Input(NULL, NULL);
$this->ci_instance($obj);
// Attach session instance locally
@@ -401,5 +397,4 @@ class Session_test extends CI_TestCase {
$this->session->native->sess_destroy();
$this->assertNull($this->session->native->userdata($key));
}
-}
-
+} \ No newline at end of file
diff --git a/tests/mocks/core/input.php b/tests/mocks/core/input.php
index 2a4aa4997..0d1873849 100644
--- a/tests/mocks/core/input.php
+++ b/tests/mocks/core/input.php
@@ -28,4 +28,14 @@ class Mock_Core_Input extends CI_Input {
return parent::_fetch_from_array($array, $index, $xss_clean);
}
+ /**
+ * Lie about being a CLI request
+ *
+ * We take advantage of this in libraries/Session_test
+ */
+ public function is_cli_request()
+ {
+ return FALSE;
+ }
+
} \ No newline at end of file