From b3a5d6e8ad90644760890182a43ed81a23b86efe Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 21 Feb 2013 22:03:23 +0200 Subject: Some miscellaneous tests --- tests/codeigniter/core/Input_test.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'tests/codeigniter') 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 -- cgit v1.2.3-24-g4f1b