@@ -830,6 +830,29 @@ public function testResponseHeaderCaseSensitivity()
830
830
$ this ->assertEquals ($ etag , $ response_headers ['eTaG ' ]);
831
831
}
832
832
833
+ public function testHeaderOutOptional ()
834
+ {
835
+ // CURLINFO_HEADER_OUT is true by default.
836
+ $ test_1 = new Test ();
837
+ $ test_1 ->server ('response_header ' , 'GET ' );
838
+ $ this ->assertNotEmpty ($ test_1 ->curl ->requestHeaders );
839
+ $ this ->assertNotEmpty ($ test_1 ->curl ->requestHeaders ['Request-Line ' ]);
840
+
841
+ // CURLINFO_HEADER_OUT is set to true.
842
+ $ test_2 = new Test ();
843
+ $ test_2 ->curl ->setOpt (CURLINFO_HEADER_OUT , true );
844
+ $ test_2 ->server ('response_header ' , 'GET ' );
845
+ $ this ->assertNotEmpty ($ test_2 ->curl ->requestHeaders );
846
+ $ this ->assertNotEmpty ($ test_2 ->curl ->requestHeaders ['Request-Line ' ]);
847
+
848
+ // CURLINFO_HEADER_OUT is set to false.
849
+ $ test_3 = new Test ();
850
+ $ test_3 ->curl ->setOpt (CURLINFO_HEADER_OUT , false );
851
+ $ test_3 ->curl ->verbose ();
852
+ $ test_3 ->server ('response_header ' , 'GET ' );
853
+ $ this ->assertNull ($ test_3 ->curl ->requestHeaders );
854
+ }
855
+
833
856
public function testHeaderRedirect ()
834
857
{
835
858
$ test = new Test ();
@@ -2384,15 +2407,6 @@ public function testClose()
2384
2407
$ this ->assertFalse (is_resource ($ curl ->curl ));
2385
2408
}
2386
2409
2387
- /**
2388
- * @expectedException PHPUnit_Framework_Error_Warning
2389
- */
2390
- public function testRequiredOptionCurlInfoHeaderOutEmitsWarning ()
2391
- {
2392
- $ curl = new Curl ();
2393
- $ curl ->setOpt (CURLINFO_HEADER_OUT , false );
2394
- }
2395
-
2396
2410
/**
2397
2411
* @expectedException PHPUnit_Framework_Error_Warning
2398
2412
*/
0 commit comments