summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/codeigniter/core/Input_test.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/codeigniter/core/Input_test.php b/tests/codeigniter/core/Input_test.php
index 80cb9a740..07a99e136 100644
--- a/tests/codeigniter/core/Input_test.php
+++ b/tests/codeigniter/core/Input_test.php
@@ -90,6 +90,23 @@ class Input_test extends CI_TestCase {
// --------------------------------------------------------------------
+ public function test_post_get_array_notation()
+ {
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_POST['foo']['bar'] = 'baz';
+ $barArray = array('bar' => 'baz');
+
+ $this->assertEquals('baz', $this->input->get_post('foo[bar]'));
+ $this->assertEquals($barArray, $this->input->get_post('foo[]'));
+ $this->assertNull($this->input->get_post('foo[baz]'));
+
+ $this->assertEquals('baz', $this->input->post_get('foo[bar]'));
+ $this->assertEquals($barArray, $this->input->post_get('foo[]'));
+ $this->assertNull($this->input->post_get('foo[baz]'));
+ }
+
+ // --------------------------------------------------------------------
+
public function test_get_post()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
@@ -100,6 +117,23 @@ class Input_test extends CI_TestCase {
// --------------------------------------------------------------------
+ public function test_get_post_array_notation()
+ {
+ $_SERVER['REQUEST_METHOD'] = 'GET';
+ $_GET['foo']['bar'] = 'baz';
+ $barArray = array('bar' => 'baz');
+
+ $this->assertEquals('baz', $this->input->get_post('foo[bar]'));
+ $this->assertEquals($barArray, $this->input->get_post('foo[]'));
+ $this->assertNull($this->input->get_post('foo[baz]'));
+
+ $this->assertEquals('baz', $this->input->post_get('foo[bar]'));
+ $this->assertEquals($barArray, $this->input->post_get('foo[]'));
+ $this->assertNull($this->input->post_get('foo[baz]'));
+ }
+
+ // --------------------------------------------------------------------
+
public function test_cookie()
{
$_COOKIE['foo'] = 'bar';