summaryrefslogtreecommitdiffstats
path: root/tests/mocks/core/security.php
diff options
context:
space:
mode:
authorTimothy Warren <tim@timshomepage.net>2012-05-17 14:02:21 +0200
committerTimothy Warren <tim@timshomepage.net>2012-05-17 14:02:21 +0200
commite8e09039b49ac5883e9e94162579841375e13c69 (patch)
treec206119bbc5bdcd573b56609b6450b14e6c20dcb /tests/mocks/core/security.php
parent43c216b998ccf8c8208b237e9e0d9c468c8a82e5 (diff)
parentae31eb5e75d914fc3ab622a7ac5c23eb1e6d9f9a (diff)
Merge upstream
Diffstat (limited to 'tests/mocks/core/security.php')
-rw-r--r--tests/mocks/core/security.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/mocks/core/security.php b/tests/mocks/core/security.php
new file mode 100644
index 000000000..d7ea0e6bd
--- /dev/null
+++ b/tests/mocks/core/security.php
@@ -0,0 +1,30 @@
+<?php
+
+class Mock_Core_Security extends CI_Security {
+
+ public function csrf_set_cookie()
+ {
+ // We cannot set cookie in CLI mode, so for csrf test, who rely on $_COOKIE,
+ // we superseded set_cookie with directly set the cookie variable,
+ // @see : ./tests/codeigniter/core/Security_test.php, line 8
+ return $this;
+ }
+
+ // Overide inaccesible protected properties
+ public function __get($property)
+ {
+ return isset($this->{'_'.$property}) ? $this->{'_'.$property} : NULL;
+ }
+
+ // Overide inaccesible protected method
+ public function __call($method, $params)
+ {
+ if (is_callable(array($this, '_'.$method)))
+ {
+ return call_user_func_array(array($this, '_'.$method), $params);
+ }
+
+ throw new BadMethodCallException('Method '.$method.' was not found');
+ }
+
+} \ No newline at end of file