@@ -373,6 +373,78 @@ function () use ($testClass): void {
373373 curl_multi_close ($ curlMultiHandle
374374 }
375375
376+  public  function  testShouldReturnMultiCallValues (): void 
377+  {
378+  $ testClass$ this 
379+  $ callCount0 ;
380+  $ this curlHook ->enable (
381+  function  (Request $ requestuse  ($ testClass$ callCount
382+  $ testClassassertEquals (
383+  'example.com ' ,
384+  $ requestgetHost (),
385+  '' 
386+  );
387+  ++$ callCount
388+ 
389+  return  new  Response ('200 ' , [], $ testClassexpected .$ callCount
390+  }
391+  );
392+ 
393+  $ curlHandle1curl_init ('http://example.com ' );
394+  Assertion::isResource ($ curlHandle1
395+  curl_setopt ($ curlHandle1CURLOPT_RETURNTRANSFER , true );
396+  $ curlHandle2curl_init ('http://example.com ' );
397+  Assertion::isResource ($ curlHandle2
398+  curl_setopt ($ curlHandle2CURLOPT_RETURNTRANSFER , true );
399+  $ curlHandle3curl_init ('http://example.com ' );
400+  Assertion::isResource ($ curlHandle3
401+  curl_setopt ($ curlHandle3CURLOPT_RETURNTRANSFER , false );
402+ 
403+  $ curlMultiHandlecurl_multi_init ();
404+  Assertion::isResource ($ curlMultiHandle
405+  curl_multi_add_handle ($ curlMultiHandle$ curlHandle1
406+  curl_multi_add_handle ($ curlMultiHandle$ curlHandle2
407+  curl_multi_add_handle ($ curlMultiHandle$ curlHandle3
408+ 
409+  $ stillRunningnull ;
410+  ob_start ();
411+  curl_multi_exec ($ curlMultiHandle$ stillRunning
412+  $ outputob_get_contents ();
413+  ob_end_clean ();
414+ 
415+  $ returnValue1curl_multi_getcontent ($ curlHandle1
416+  $ returnValue2curl_multi_getcontent ($ curlHandle2
417+  $ returnValue3curl_multi_getcontent ($ curlHandle3
418+ 
419+  curl_multi_remove_handle ($ curlMultiHandle$ curlHandle1
420+  curl_multi_remove_handle ($ curlMultiHandle$ curlHandle2
421+  curl_multi_remove_handle ($ curlMultiHandle$ curlHandle3
422+  curl_multi_close ($ curlMultiHandle
423+ 
424+  $ this curlHook ->disable ();
425+ 
426+  $ this assertEquals (3 , $ callCount'Hook should have been called thrice. ' );
427+  $ this assertSame (
428+  $ this expected .'1 ' ,
429+  $ returnValue1
430+  'When called with the first handle the curl_multi_getcontent should return the body of the first response. ' 
431+  );
432+ 
433+  $ this assertSame (
434+  $ this expected .'2 ' ,
435+  $ returnValue2
436+  'When called with the second handle the curl_multi_getcontent should return the body of the second response. ' 
437+  );
438+ 
439+  $ this assertNull ($ returnValue3'When called with the third handle the curl_multi_getcontent should return null. ' );
440+ 
441+  $ this assertSame (
442+  $ this expected .'3 ' ,
443+  $ output
444+  'The third response was not written on stdout. ' 
445+  );
446+  }
447+ 
376448 /** 
377449 * @requires PHP 5.5.0 
378450 */ 
0 commit comments