Permalink
Browse files

Overloaded is_cli_request in Input mock for Session test

Signed-off-by: dchill42 <dchill42@gmail.com>
  • Loading branch information...
1 parent 2e3e230 commit 82003dac7e1da25ffb0d925ba197121b5b7b27f5 @dchill42 committed Oct 9, 2012
Showing with 16 additions and 11 deletions.
  1. +6 −11 tests/codeigniter/libraries/Session_test.php
  2. +10 −0 tests/mocks/core/input.php
@@ -30,15 +30,11 @@ public function set_up()
// 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 @@ public function test_sess_destroy()
$this->session->native->sess_destroy();
$this->assertNull($this->session->native->userdata($key));
}
-}
-
+}
View
@@ -28,4 +28,14 @@ public function fetch_from_array($array, $index = '', $xss_clean = FALSE)
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;
+ }
+
}

0 comments on commit 82003da

Please sign in to comment.