summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/core
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2013-02-21 21:03:23 +0100
committerAndrey Andreev <narf@bofh.bg>2013-02-21 21:03:23 +0100
commitb3a5d6e8ad90644760890182a43ed81a23b86efe (patch)
tree812fefc1a9184593322de04fae3b8cff6d501277 /tests/codeigniter/core
parent452b668d4edda5ae04c16f494bffe09114afc3ba (diff)
Some miscellaneous tests
Diffstat (limited to 'tests/codeigniter/core')
-rw-r--r--tests/codeigniter/core/Input_test.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/codeigniter/core/Input_test.php b/tests/codeigniter/core/Input_test.php
index ca1c6dfd7..5cf25fefa 100644
--- a/tests/codeigniter/core/Input_test.php
+++ b/tests/codeigniter/core/Input_test.php
@@ -95,8 +95,8 @@ class Input_test extends CI_TestCase {
public function test_cookie()
{
$_COOKIE['foo'] = 'bar';
-
$this->assertEquals('bar', $this->input->cookie('foo'));
+ $this->assertNull($this->input->cookie('bar'));
}
// --------------------------------------------------------------------
@@ -138,4 +138,27 @@ class Input_test extends CI_TestCase {
}
}
+ // --------------------------------------------------------------------
+
+ public function test_method()
+ {
+ $_SERVER['REQUEST_METHOD'] = 'GET';
+ $this->assertEquals('get', $this->input->method());
+ $this->assertEquals('GET', $this->input->method(TRUE));
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $this->assertEquals('post', $this->input->method());
+ $this->assertEquals('POST', $this->input->method(TRUE));
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_is_ajax_request()
+ {
+ $this->assertFalse($this->input->is_ajax_request());
+ $_SERVER['HTTP_X_REQUESTED_WITH'] = 'test';
+ $this->assertFalse($this->input->is_ajax_request());
+ $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
+ $this->assertTrue($this->input->is_ajax_request());
+ }
+
} \ No newline at end of file