summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/core/Input_test.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codeigniter/core/Input_test.php')
-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