@@ -90,6 +90,23 @@ public function test_post_get()
90
90
91
91
// --------------------------------------------------------------------
92
92
93
+ public function test_post_get_array_notation ()
94
+ {
95
+ $ _SERVER ['REQUEST_METHOD ' ] = 'POST ' ;
96
+ $ _POST ['foo ' ]['bar ' ] = 'baz ' ;
97
+ $ barArray = array ('bar ' => 'baz ' );
98
+
99
+ $ this ->assertEquals ('baz ' , $ this ->input ->get_post ('foo[bar] ' ));
100
+ $ this ->assertEquals ($ barArray , $ this ->input ->get_post ('foo[] ' ));
101
+ $ this ->assertNull ($ this ->input ->get_post ('foo[baz] ' ));
102
+
103
+ $ this ->assertEquals ('baz ' , $ this ->input ->post_get ('foo[bar] ' ));
104
+ $ this ->assertEquals ($ barArray , $ this ->input ->post_get ('foo[] ' ));
105
+ $ this ->assertNull ($ this ->input ->post_get ('foo[baz] ' ));
106
+ }
107
+
108
+ // --------------------------------------------------------------------
109
+
93
110
public function test_get_post ()
94
111
{
95
112
$ _SERVER ['REQUEST_METHOD ' ] = 'GET ' ;
@@ -100,6 +117,23 @@ public function test_get_post()
100
117
101
118
// --------------------------------------------------------------------
102
119
120
+ public function test_get_post_array_notation ()
121
+ {
122
+ $ _SERVER ['REQUEST_METHOD ' ] = 'GET ' ;
123
+ $ _GET ['foo ' ]['bar ' ] = 'baz ' ;
124
+ $ barArray = array ('bar ' => 'baz ' );
125
+
126
+ $ this ->assertEquals ('baz ' , $ this ->input ->get_post ('foo[bar] ' ));
127
+ $ this ->assertEquals ($ barArray , $ this ->input ->get_post ('foo[] ' ));
128
+ $ this ->assertNull ($ this ->input ->get_post ('foo[baz] ' ));
129
+
130
+ $ this ->assertEquals ('baz ' , $ this ->input ->post_get ('foo[bar] ' ));
131
+ $ this ->assertEquals ($ barArray , $ this ->input ->post_get ('foo[] ' ));
132
+ $ this ->assertNull ($ this ->input ->post_get ('foo[baz] ' ));
133
+ }
134
+
135
+ // --------------------------------------------------------------------
136
+
103
137
public function test_cookie ()
104
138
{
105
139
$ _COOKIE ['foo ' ] = 'bar ' ;
0 commit comments