@@ -59,6 +59,7 @@ public function testHttpClientGetSetData(): void
5959 public function testHttpClientIsMultiRequest (): void
6060 {
6161 $ curl = Mockery::mock (Curl::class);
62+ $ curl ->shouldReceive ('setUrl ' )->with ('https://example.com ' )->once ();
6263
6364 $ multi = Mockery::mock (MultiCurl::class);
6465
@@ -107,6 +108,8 @@ public function testHttpClientEnsureSingleRequestThrowsOnMulti(): void
107108 public function testHttpClientSingleRequestResponseFlow (): void
108109 {
109110 $ curl = Mockery::mock (Curl::class);
111+ $ curl ->shouldReceive ('setUrl ' )->with ('https://example.com ' )->once ();
112+ $ curl ->shouldReceive ('setOpt ' )->with (CURLOPT_CUSTOMREQUEST , 'GET ' )->once ();
110113 $ curl ->shouldReceive ('exec ' )->once ();
111114 $ curl ->shouldReceive ('isError ' )->andReturn (false );
112115 $ curl ->shouldReceive ('getId ' )->andReturn (0 );
@@ -129,6 +132,10 @@ public function testHttpClientSingleRequestResponseFlow(): void
129132 public function testHttpClientPostRequestWithData (): void
130133 {
131134 $ curl = Mockery::mock (Curl::class);
135+ $ curl ->shouldReceive ('setUrl ' )->with ('https://example.com ' )->once ();
136+ $ curl ->shouldReceive ('setOpt ' )->with (CURLOPT_CUSTOMREQUEST , 'POST ' )->once ();
137+ $ curl ->shouldReceive ('buildPostData ' )->with (['x ' => 1 ])->once ()->andReturn ('x=1 ' );
138+ $ curl ->shouldReceive ('setOpt ' )->with (CURLOPT_POSTFIELDS , 'x=1 ' )->once ();
132139 $ curl ->shouldReceive ('exec ' )->once ();
133140 $ curl ->shouldReceive ('isError ' )->andReturn (false );
134141 $ curl ->shouldReceive ('getId ' )->andReturn (0 );
@@ -148,6 +155,8 @@ public function testHttpClientPostRequestWithData(): void
148155 public function testHttpClientSingleRequestError (): void
149156 {
150157 $ curl = Mockery::mock (Curl::class);
158+ $ curl ->shouldReceive ('setUrl ' )->with ('https://bad.local ' )->once ();
159+ $ curl ->shouldReceive ('setOpt ' )->with (CURLOPT_CUSTOMREQUEST , 'GET ' )->once ();
151160 $ curl ->shouldReceive ('exec ' )->once ();
152161 $ curl ->shouldReceive ('isError ' )->andReturn (true );
153162 $ curl ->shouldReceive ('getId ' )->andReturn (0 );
@@ -266,6 +275,8 @@ public function testHttpClientCreateAsyncMultiRequestRegistersCallbacks(): void
266275 public function testHttpClientInfoAndUrl (): void
267276 {
268277 $ curl = Mockery::mock (Curl::class);
278+ $ curl ->shouldReceive ('setUrl ' )->with ('https://example.com ' )->once ();
279+ $ curl ->shouldReceive ('setOpt ' )->with (CURLOPT_CUSTOMREQUEST , 'GET ' )->once ();
269280 $ curl ->shouldReceive ('exec ' )->once ();
270281 $ curl ->shouldReceive ('isError ' )->andReturn (false );
271282 $ curl ->shouldReceive ('getId ' )->andReturn (0 );
@@ -288,6 +299,7 @@ public function testHttpClientInfoAndUrl(): void
288299 public function testHttpClientPassesZeroInfoOption (): void
289300 {
290301 $ curl = Mockery::mock (Curl::class);
302+ $ curl ->shouldReceive ('setUrl ' )->with ('https://example.com ' )->once ();
291303 $ curl ->shouldReceive ('getInfo ' )->with (0 )->once ()->andReturn ('zero ' );
292304
293305 $ this ->httpClient ->createRequest ('https://example.com ' , $ curl );
0 commit comments