@@ -37,7 +37,6 @@ public function testCanOpenGetCurlConnection()
3737 ->with (m::on (function ($ arg ) {
3838 $ caInfo = array_diff ($ arg , [
3939 CURLOPT_CUSTOMREQUEST => 'GET ' ,
40- CURLOPT_HTTPHEADER => [],
4140 CURLOPT_URL => 'http://foo.com ' ,
4241 CURLOPT_CONNECTTIMEOUT => 10 ,
4342 CURLOPT_TIMEOUT => 60 ,
@@ -72,11 +71,15 @@ public function testCanOpenGetCurlConnectionWithHeaders()
7271 $ this ->curlMock
7372 ->shouldReceive ('setopt_array ' )
7473 ->with (m::on (function ($ arg ) {
74+
75+ // array_diff() will sometimes trigger error on multidimensional arrays
76+ if (['X-foo: bar ' ] !== $ arg [CURLOPT_HTTPHEADER ]) {
77+ return false ;
78+ }
79+ unset($ arg [CURLOPT_HTTPHEADER ]);
80+
7581 $ caInfo = array_diff ($ arg , [
7682 CURLOPT_CUSTOMREQUEST => 'GET ' ,
77- CURLOPT_HTTPHEADER => array (
78- 'X-foo: bar ' ,
79- ),
8083 CURLOPT_URL => 'http://foo.com ' ,
8184 CURLOPT_CONNECTTIMEOUT => 10 ,
8285 CURLOPT_TIMEOUT => 60 ,
@@ -114,17 +117,14 @@ public function testCanOpenPostCurlConnection()
114117 ->with (m::on (function ($ arg ) {
115118 $ caInfo = array_diff ($ arg , [
116119 CURLOPT_CUSTOMREQUEST => 'POST ' ,
117- CURLOPT_HTTPHEADER => [],
118120 CURLOPT_URL => 'http://bar.com ' ,
119121 CURLOPT_CONNECTTIMEOUT => 10 ,
120122 CURLOPT_TIMEOUT => 60 ,
121123 CURLOPT_RETURNTRANSFER => true ,
122124 CURLOPT_HEADER => true ,
123125 CURLOPT_SSL_VERIFYHOST => 2 ,
124126 CURLOPT_SSL_VERIFYPEER => true ,
125- CURLOPT_POSTFIELDS => array (
126- 'baz ' => 'bar ' ,
127- ),
127+ CURLOPT_POSTFIELDS => 'baz=bar&foo%5B0%5D=1&foo%5B1%5D=2&foo%5B2%5D=3 ' ,
128128 ]);
129129
130130 if (count ($ caInfo ) !== 1 ) {
@@ -140,47 +140,12 @@ public function testCanOpenPostCurlConnection()
140140 ->once ()
141141 ->andReturn (null );
142142
143- $ this ->curlClient ->openConnection ('http://bar.com ' , 'POST ' , array ('baz ' => 'bar ' ));
144- }
145-
146- public function testCanOpenPutCurlConnection ()
147- {
148- $ this ->curlMock
149- ->shouldReceive ('init ' )
150- ->once ()
151- ->andReturn (null );
152- $ this ->curlMock
153- ->shouldReceive ('setopt_array ' )
154- ->with (m::on (function ($ arg ) {
155- $ caInfo = array_diff ($ arg , [
156- CURLOPT_CUSTOMREQUEST => 'PUT ' ,
157- CURLOPT_HTTPHEADER => [],
158- CURLOPT_URL => 'http://baz.com ' ,
159- CURLOPT_CONNECTTIMEOUT => 10 ,
160- CURLOPT_TIMEOUT => 60 ,
161- CURLOPT_RETURNTRANSFER => true ,
162- CURLOPT_HEADER => true ,
163- CURLOPT_SSL_VERIFYHOST => 2 ,
164- CURLOPT_SSL_VERIFYPEER => true ,
165- CURLOPT_POSTFIELDS => array (
166- 'baz ' => 'bar ' ,
167- ),
168- ]);
169-
170- if (count ($ caInfo ) !== 1 ) {
171- return false ;
172- }
173-
174- if (1 !== preg_match ('/.+\/certs\/DigiCertHighAssuranceEVRootCA\.pem$/ ' , $ caInfo [CURLOPT_CAINFO ])) {
175- return false ;
176- }
177-
178- return true ;
179- }))
180- ->once ()
181- ->andReturn (null );
182-
183- $ this ->curlClient ->openConnection ('http://baz.com ' , 'PUT ' , array ('baz ' => 'bar ' ));
143+ // Prove can support multidimensional params
144+ $ params = array (
145+ 'baz ' => 'bar ' ,
146+ 'foo ' => array (1 , 2 , 3 ),
147+ );
148+ $ this ->curlClient ->openConnection ('http://bar.com ' , 'POST ' , $ params );
184149 }
185150
186151 public function testCanOpenDeleteCurlConnection ()
@@ -194,17 +159,14 @@ public function testCanOpenDeleteCurlConnection()
194159 ->with (m::on (function ($ arg ) {
195160 $ caInfo = array_diff ($ arg , [
196161 CURLOPT_CUSTOMREQUEST => 'DELETE ' ,
197- CURLOPT_HTTPHEADER => [],
198162 CURLOPT_URL => 'http://faz.com ' ,
199163 CURLOPT_CONNECTTIMEOUT => 10 ,
200164 CURLOPT_TIMEOUT => 60 ,
201165 CURLOPT_RETURNTRANSFER => true ,
202166 CURLOPT_HEADER => true ,
203167 CURLOPT_SSL_VERIFYHOST => 2 ,
204168 CURLOPT_SSL_VERIFYPEER => true ,
205- CURLOPT_POSTFIELDS => array (
206- 'baz ' => 'bar ' ,
207- ),
169+ CURLOPT_POSTFIELDS => 'baz=bar ' ,
208170 ]);
209171
210172 if (count ($ caInfo ) !== 1 ) {
0 commit comments