3 class MockCookie
extends Cookie
{
4 public function canServeDomain( $arg ) { return parent
::canServeDomain( $arg ); }
5 public function canServePath( $arg ) { return parent
::canServePath( $arg ); }
6 public function isUnExpired() { return parent
::isUnExpired(); }
12 class HttpTest
extends PHPUnit_Framework_TestCase
{
17 static $has_proxy = false;
18 static $proxy = "http://hulk:8080/";
19 var $test_geturl = array(
20 "http://www.example.com/",
21 "http://pecl.php.net/feeds/pkg_apc.rss",
22 "http://toolserver.org/~jan/poll/dev/main.php?page=wiki_output&id=3",
23 "http://meta.wikimedia.org/w/index.php?title=Interwiki_map&action=raw",
24 "http://www.mediawiki.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:MediaWiki_hooks&format=php",
26 var $test_requesturl = array( "http://en.wikipedia.org/wiki/Special:Export/User:MarkAHershberger" );
28 var $test_posturl = array( "http://www.comp.leeds.ac.uk/cgi-bin/Perl/environment-example" => "review=test" );
31 putenv( "http_proxy" ); /* Remove any proxy env var, so curl doesn't get confused */
32 if ( is_array( self
::$content ) ) {
35 self
::$has_curl = function_exists( 'curl_init' );
36 self
::$has_fopen = wfIniGetBool( 'allow_url_fopen' );
38 if ( !file_exists( "/usr/bin/curl" ) ) {
39 $this->markTestIncomplete( "This test requires the curl binary at /usr/bin/curl. If you have curl, please file a bug on this test, or, better yet, provide a patch." );
42 $content = tempnam( wfTempDir(), "" );
43 $headers = tempnam( wfTempDir(), "" );
44 if ( !$content && !$headers ) {
45 die( "Couldn't create temp file!" );
48 // This probably isn't the best test for a proxy, but it works on my system!
49 system( "curl -0 -o $content -s " . self
::$proxy );
50 $out = file_get_contents( $content );
52 self
::$has_proxy = true;
55 /* Maybe use wget instead of curl here ... just to use a different codebase? */
56 foreach ( $this->test_geturl
as $u ) {
57 system( "curl -0 -s -D $headers '$u' -o $content" );
58 self
::$content["GET $u"] = file_get_contents( $content );
59 self
::$headers["GET $u"] = file_get_contents( $headers );
61 foreach ( $this->test_requesturl
as $u ) {
62 system( "curl -0 -s -X POST -H 'Content-Length: 0' -D $headers '$u' -o $content" );
63 self
::$content["POST $u"] = file_get_contents( $content );
64 self
::$headers["POST $u"] = file_get_contents( $headers );
66 foreach ( $this->test_posturl
as $u => $postData ) {
67 system( "curl -0 -s -X POST -d '$postData' -D $headers '$u' -o $content" );
68 self
::$content["POST $u => $postData"] = file_get_contents( $content );
69 self
::$headers["POST $u => $postData"] = file_get_contents( $headers );
76 function testInstantiation() {
77 Http
::$httpEngine = false;
79 $r = MWHttpRequest
::factory( "http://www.example.com/" );
80 if ( self
::$has_curl ) {
81 $this->assertThat( $r, $this->isInstanceOf( 'CurlHttpRequest' ) );
83 $this->assertThat( $r, $this->isInstanceOf( 'PhpHttpRequest' ) );
87 if ( !self
::$has_fopen ) {
88 $this->setExpectedException( 'MWException' );
90 Http
::$httpEngine = 'php';
91 $r = MWHttpRequest
::factory( "http://www.example.com/" );
92 $this->assertThat( $r, $this->isInstanceOf( 'PhpHttpRequest' ) );
95 if ( !self
::$has_curl ) {
96 $this->setExpectedException( 'MWException' );
98 Http
::$httpEngine = 'curl';
99 $r = MWHttpRequest
::factory( "http://www.example.com/" );
100 if ( self
::$has_curl ) {
101 $this->assertThat( $r, $this->isInstanceOf( 'CurlHttpRequest' ) );
105 function runHTTPFailureChecks() {
106 // Each of the following requests should result in a failure.
109 $start_time = time();
110 $r = Http
::get( "http://www.example.com:1/", $timeout );
112 $this->assertLessThan( $timeout +
2, $end_time - $start_time,
113 "Request took less than {$timeout}s via " . Http
::$httpEngine );
114 $this->assertEquals( $r, false, "false -- what we get on error from Http::get()" );
116 $r = Http
::get( "http://www.example.com/this-file-does-not-exist", $timeout );
117 $this->assertFalse( $r, "False on 404s" );
120 $r = MWHttpRequest
::factory( "http://www.example.com/this-file-does-not-exist" );
122 if ( $r instanceof PhpHttpRequest
&& version_compare( '5.2.10', phpversion(), '>' ) ) {
123 $this->assertRegexp( "/HTTP request failed/", $er->getWikiText() );
125 $this->assertRegexp( "/404 Not Found/", $er->getWikiText() );
129 function testFailureDefault() {
130 Http
::$httpEngine = false;
131 $this->runHTTPFailureChecks();
134 function testFailurePhp() {
135 if ( !self
::$has_fopen ) {
136 $this->markTestIncomplete( "This test requires allow_url_fopen=true." );
139 Http
::$httpEngine = "php";
140 $this->runHTTPFailureChecks();
143 function testFailureCurl() {
144 if ( !self
::$has_curl ) {
145 $this->markTestIncomplete( "This test requires curl." );
148 Http
::$httpEngine = "curl";
149 $this->runHTTPFailureChecks();
152 /* ./phase3/includes/Import.php:1108: $data = Http::request( $method, $url ); */
153 /* ./includes/Import.php:1124: $link = Title::newFromText( "$interwiki:Special:Export/$page" ); */
154 /* ./includes/Import.php:1134: return ImportStreamSource::newFromURL( $url, "POST" ); */
155 function runHTTPRequests( $proxy = null ) {
159 $opt['proxy'] = $proxy;
160 } elseif ( $proxy === false ) {
161 $opt['noProxy'] = true;
164 /* no postData here because the only request I could find in code so far didn't have any */
165 foreach ( $this->test_requesturl
as $u ) {
166 $r = Http
::request( "POST", $u, $opt );
167 $this->assertEquals( self
::$content["POST $u"], "$r", "POST $u with " . Http
::$httpEngine );
171 function testRequestDefault() {
172 Http
::$httpEngine = false;
173 $this->runHTTPRequests();
176 function testRequestPhp() {
177 if ( !self
::$has_fopen ) {
178 $this->markTestIncomplete( "This test requires allow_url_fopen=true." );
181 Http
::$httpEngine = "php";
182 $this->runHTTPRequests();
185 function testRequestCurl() {
186 if ( !self
::$has_curl ) {
187 $this->markTestIncomplete( "This test requires curl." );
190 Http
::$httpEngine = "curl";
191 $this->runHTTPRequests();
194 /* ./extensions/SpamBlacklist/SpamBlacklist_body.php:164: $httpText = Http::get( $fileName ); */
195 /* ./extensions/ApiSVGProxy/ApiSVGProxy.body.php:44: $contents = Http::get( $file->getFullUrl() ); */
196 /* ./extensions/BookInformation/drivers/IsbnDb.php:24: if( ( $xml = Http::get( $uri ) ) !== false ) { */
197 /* ./extensions/BookInformation/drivers/Amazon.php:23: if( ( $xml = Http::get( $uri ) ) !== false ) { */
198 /* ./extensions/TitleBlacklist/TitleBlacklist.list.php:217: $result = Http::get( $url ); */
199 /* ./extensions/TSPoll/TSPoll.php:68: $get_server = Http::get( 'http://toolserver.org/~jan/poll/dev/main.php?page=wiki_output&id='.$id ); */
200 /* ./extensions/TSPoll/TSPoll.php:70: $get_server = Http::get( 'http://toolserver.org/~jan/poll/main.php?page=wiki_output&id='.$id ); */
201 /* ./extensions/DoubleWiki/DoubleWiki.php:56: $translation = Http::get( $url.$sep.'action=render' ); */
202 /* ./extensions/ExternalPages/ExternalPages_body.php:177: $serializedText = Http::get( $this->mPageURL ); */
203 /* ./extensions/Translate/utils/TranslationHelpers.php:143: $suggestions = Http::get( $url, $timeout ); */
204 /* ./extensions/Translate/SpecialImportTranslations.php:169: $filedata = Http::get( $url ); ; */
205 /* ./extensions/Translate/TranslateEditAddons.php:338: $suggestions = Http::get( $url, $timeout ); */
206 /* ./extensions/SecurePoll/includes/user/Auth.php:283: $value = Http::get( $url, 20, $curlParams ); */
207 /* ./extensions/DumpHTML/dumpHTML.inc:778: $contents = Http::get( $url ); */
208 /* ./extensions/DumpHTML/dumpHTML.inc:1298: $contents = Http::get( $sourceUrl ); */
209 /* ./extensions/DumpHTML/dumpHTML.inc:1373: $contents = Http::get( $sourceUrl ); */
210 /* ./phase3/maintenance/rebuildInterwiki.inc:101: $intermap = Http::get( 'http://meta.wikimedia.org/w/index.php?title=Interwiki_map&action=raw', 30 ); */
211 /* ./phase3/maintenance/findhooks.php:98: $allhookdata = Http::get( 'http://www.mediawiki.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:MediaWiki_hooks&cmlimit=500&format=php' ); */
212 /* ./phase3/maintenance/findhooks.php:109: $oldhookdata = Http::get( 'http://www.mediawiki.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Removed_hooks&cmlimit=500&format=php' ); */
213 /* ./phase3/maintenance/dumpInterwiki.inc:95: $intermap = Http::get( 'http://meta.wikimedia.org/w/index.php?title=Interwiki_map&action=raw', 30 ); */
214 /* ./phase3/includes/parser/Parser.php:3204: $text = Http::get($url); */
215 /* ./phase3/includes/filerepo/ForeignAPIRepo.php:131: $data = Http::get( $url ); */
216 /* ./phase3/includes/filerepo/ForeignAPIRepo.php:205: $thumb = Http::get( $foreignUrl ); */
217 /* ./phase3/includes/filerepo/File.php:1105: $res = Http::get( $renderUrl ); */
218 /* ./phase3/includes/GlobalFunctions.php:2760: * @deprecated Use Http::get() instead */
219 /* ./phase3/includes/GlobalFunctions.php:2764: return Http::get( $url ); */
220 /* ./phase3/includes/ExternalStoreHttp.php:18: $ret = Http::get( $url ); */
221 /* ./phase3/includes/Import.php:357: $data = Http::get( $src ); */
222 /* ./extensions/ExternalData/ED_Utils.php:291: return Http::get( $url, 'default', array(CURLOPT_SSL_VERIFYPEER => false) ); */
223 /* ./extensions/ExternalData/ED_Utils.php:293: return Http::get( $url ); */
224 /* ./extensions/ExternalData/ED_Utils.php:306: $page = Http::get( $url, 'default', array(CURLOPT_SSL_VERIFYPEER => false) ); */
225 /* ./extensions/ExternalData/ED_Utils.php:308: $page = Http::get( $url ); */
226 /* ./extensions/CodeReview/backend/Subversion.php:320: $blob = Http::get( $target, $this->mTimeout ); */
227 /* ./extensions/AmazonPlus/AmazonPlus.php:214: $this->response = Http::get( $urlstr ); */
228 /* ./extensions/StaticWiki/StaticWiki.php:24: $text = Http::get( $url ) ; */
229 /* ./extensions/StaticWiki/StaticWiki.php:64: $history = Http::get ( $wgStaticWikiExternalSite . "index.php?title=" . urlencode ( $url_title ) . "&action=history" ) ; */
230 /* ./extensions/Configure/scripts/findSettings.php:126: $cont = Http::get( "http://www.mediawiki.org/w/index.php?title={$page}&action=raw" ); */
231 /* ./extensions/TorBlock/TorBlock.class.php:148: $data = Http::get( $url ); */
232 /* ./extensions/HoneypotIntegration/HoneypotIntegration.class.php:60: $data = Http::get( $wgHoneypotURLSource, 'default', */
233 /* ./extensions/SemanticForms/includes/SF_Utils.inc:378: $page_contents = Http::get($url); */
234 /* ./extensions/LocalisationUpdate/LocalisationUpdate.class.php:172: $basefilecontents = Http::get( $basefile ); */
235 /* ./extensions/APC/SpecialAPC.php:245: $rss = Http::get( 'http://pecl.php.net/feeds/pkg_apc.rss' ); */
236 /* ./extensions/Interlanguage/Interlanguage.php:56: $a = Http::get( $url ); */
237 /* ./extensions/MWSearch/MWSearch_body.php:492: $data = Http::get( $searchUrl, $wgLuceneSearchTimeout, $httpOpts); */
238 function runHTTPGets( $proxy = null ) {
242 $opt['proxy'] = $proxy;
243 } elseif ( $proxy === false ) {
244 $opt['noProxy'] = true;
247 foreach ( $this->test_geturl
as $u ) {
248 $r = Http
::get( $u, 30, $opt ); /* timeout of 30s */
249 $this->assertEquals( self
::$content["GET $u"], "$r", "Get $u with " . Http
::$httpEngine );
253 function testGetDefault() {
254 Http
::$httpEngine = false;
255 $this->runHTTPGets();
258 function testGetPhp() {
259 if ( !self
::$has_fopen ) {
260 $this->markTestIncomplete( "This test requires allow_url_fopen=true." );
263 Http
::$httpEngine = "php";
264 $this->runHTTPGets();
267 function testGetCurl() {
268 if ( !self
::$has_curl ) {
269 $this->markTestIncomplete( "This test requires curl." );
272 Http
::$httpEngine = "curl";
273 $this->runHTTPGets();
276 /* ./phase3/maintenance/parserTests.inc:1618: return Http::post( $url, array( 'postData' => wfArrayToCGI( $data ) ) ); */
277 function runHTTPPosts( $proxy = null ) {
281 $opt['proxy'] = $proxy;
282 } elseif ( $proxy === false ) {
283 $opt['noProxy'] = true;
286 foreach ( $this->test_posturl
as $u => $postData ) {
287 $opt['postData'] = $postData;
288 $r = Http
::post( $u, $opt );
289 $this->assertEquals( self
::$content["POST $u => $postData"], "$r",
290 "POST $u (postData=$postData) with " . Http
::$httpEngine );
294 function testPostDefault() {
295 Http
::$httpEngine = false;
296 $this->runHTTPPosts();
299 function testPostPhp() {
300 if ( !self
::$has_fopen ) {
301 $this->markTestIncomplete( "This test requires allow_url_fopen=true." );
304 Http
::$httpEngine = "php";
305 $this->runHTTPPosts();
308 function testPostCurl() {
309 if ( !self
::$has_curl ) {
310 $this->markTestIncomplete( "This test requires curl." );
313 Http
::$httpEngine = "curl";
314 $this->runHTTPPosts();
317 function runProxyRequests() {
318 if ( !self
::$has_proxy ) {
319 $this->markTestIncomplete( "This test requires a proxy." );
321 $this->runHTTPGets( self
::$proxy );
322 $this->runHTTPPosts( self
::$proxy );
323 $this->runHTTPRequests( self
::$proxy );
325 // Set false here to do noProxy
326 $this->runHTTPGets( false );
327 $this->runHTTPPosts( false );
328 $this->runHTTPRequests( false );
331 function testProxyDefault() {
332 Http
::$httpEngine = false;
333 $this->runProxyRequests();
336 function testProxyPhp() {
337 if ( !self
::$has_fopen ) {
338 $this->markTestIncomplete( "This test requires allow_url_fopen=true." );
341 Http
::$httpEngine = 'php';
342 $this->runProxyRequests();
345 function testProxyCurl() {
346 if ( !self
::$has_curl ) {
347 $this->markTestIncomplete( "This test requires curl." );
350 Http
::$httpEngine = 'curl';
351 $this->runProxyRequests();
354 function testIsLocalUrl() {
357 /* ./extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php:559: $user_agent = Http::userAgent(); */
358 function testUserAgent() {
361 function testIsValidUrl() {
364 function testValidateCookieDomain() {
365 $this->assertFalse( Cookie
::validateCookieDomain( "co.uk" ) );
366 $this->assertFalse( Cookie
::validateCookieDomain( ".co.uk" ) );
367 $this->assertFalse( Cookie
::validateCookieDomain( "gov.uk" ) );
368 $this->assertFalse( Cookie
::validateCookieDomain( ".gov.uk" ) );
369 $this->assertTrue( Cookie
::validateCookieDomain( "supermarket.uk" ) );
370 $this->assertFalse( Cookie
::validateCookieDomain( "uk" ) );
371 $this->assertFalse( Cookie
::validateCookieDomain( ".uk" ) );
372 $this->assertFalse( Cookie
::validateCookieDomain( "127.0.0." ) );
373 $this->assertFalse( Cookie
::validateCookieDomain( "127." ) );
374 $this->assertFalse( Cookie
::validateCookieDomain( "127.0.0.1." ) );
375 $this->assertTrue( Cookie
::validateCookieDomain( "127.0.0.1" ) );
376 $this->assertFalse( Cookie
::validateCookieDomain( "333.0.0.1" ) );
377 $this->assertTrue( Cookie
::validateCookieDomain( "example.com" ) );
378 $this->assertFalse( Cookie
::validateCookieDomain( "example.com." ) );
379 $this->assertTrue( Cookie
::validateCookieDomain( ".example.com" ) );
381 $this->assertTrue( Cookie
::validateCookieDomain( ".example.com", "www.example.com" ) );
382 $this->assertFalse( Cookie
::validateCookieDomain( "example.com", "www.example.com" ) );
383 $this->assertTrue( Cookie
::validateCookieDomain( "127.0.0.1", "127.0.0.1" ) );
384 $this->assertFalse( Cookie
::validateCookieDomain( "127.0.0.1", "localhost" ) );
389 function testSetCooke() {
390 $c = new MockCookie( "name", "value",
395 $this->assertFalse( $c->canServeDomain( "ac.th" ) );
397 $c = new MockCookie( "name", "value",
399 "domain" => "example.com",
403 $this->assertTrue( $c->canServeDomain( "example.com" ) );
404 $this->assertFalse( $c->canServeDomain( "www.example.com" ) );
406 $c = new MockCookie( "name", "value",
408 "domain" => ".example.com",
412 $this->assertFalse( $c->canServeDomain( "www.example.net" ) );
413 $this->assertFalse( $c->canServeDomain( "example.com" ) );
414 $this->assertTrue( $c->canServeDomain( "www.example.com" ) );
416 $this->assertFalse( $c->canServePath( "/" ) );
417 $this->assertFalse( $c->canServePath( "/bogus/path/" ) );
418 $this->assertFalse( $c->canServePath( "/path" ) );
419 $this->assertTrue( $c->canServePath( "/path/" ) );
421 $this->assertTrue( $c->isUnExpired() );
423 $this->assertEquals( "", $c->serializeToHttpRequest( "/path/", "www.example.net" ) );
424 $this->assertEquals( "", $c->serializeToHttpRequest( "/", "www.example.com" ) );
425 $this->assertEquals( "name=value", $c->serializeToHttpRequest( "/path/", "www.example.com" ) );
427 $c = new MockCookie( "name", "value",
429 "domain" => "www.example.com",
432 $this->assertFalse( $c->canServeDomain( "example.com" ) );
433 $this->assertFalse( $c->canServeDomain( "www.example.net" ) );
434 $this->assertTrue( $c->canServeDomain( "www.example.com" ) );
436 $c = new MockCookie( "name", "value",
438 "domain" => ".example.com",
440 "expires" => "-1 day",
442 $this->assertFalse( $c->isUnExpired() );
443 $this->assertEquals( "", $c->serializeToHttpRequest( "/path/", "www.example.com" ) );
445 $c = new MockCookie( "name", "value",
447 "domain" => ".example.com",
449 "expires" => "+1 day",
451 $this->assertTrue( $c->isUnExpired() );
452 $this->assertEquals( "name=value", $c->serializeToHttpRequest( "/path/", "www.example.com" ) );
455 function testCookieJarSetCookie() {
457 $cj->setCookie( "name", "value",
459 "domain" => ".example.com",
462 $cj->setCookie( "name2", "value",
464 "domain" => ".example.com",
465 "path" => "/path/sub",
467 $cj->setCookie( "name3", "value",
469 "domain" => ".example.com",
472 $cj->setCookie( "name4", "value",
474 "domain" => ".example.net",
477 $cj->setCookie( "name5", "value",
479 "domain" => ".example.net",
481 "expires" => "-1 day",
484 $this->assertEquals( "name4=value", $cj->serializeToHttpRequest( "/path/", "www.example.net" ) );
485 $this->assertEquals( "name3=value", $cj->serializeToHttpRequest( "/", "www.example.com" ) );
486 $this->assertEquals( "name=value; name3=value", $cj->serializeToHttpRequest( "/path/", "www.example.com" ) );
488 $cj->setCookie( "name5", "value",
490 "domain" => ".example.net",
492 "expires" => "+1 day",
494 $this->assertEquals( "name4=value; name5=value", $cj->serializeToHttpRequest( "/path/", "www.example.net" ) );
496 $cj->setCookie( "name4", "value",
498 "domain" => ".example.net",
500 "expires" => "-1 day",
502 $this->assertEquals( "name5=value", $cj->serializeToHttpRequest( "/path/", "www.example.net" ) );
505 function testParseResponseHeader() {
508 $h[] = "Set-Cookie: name4=value; domain=.example.com; path=/; expires=Mon, 09-Dec-2029 13:46:00 GMT";
509 $cj->parseCookieResponseHeader( $h[0], "www.example.com" );
510 $this->assertEquals( "name4=value", $cj->serializeToHttpRequest( "/", "www.example.com" ) );
512 $h[] = "name4=value2; domain=.example.com; path=/path/; expires=Mon, 09-Dec-2029 13:46:00 GMT";
513 $cj->parseCookieResponseHeader( $h[1], "www.example.com" );
514 $this->assertEquals( "", $cj->serializeToHttpRequest( "/", "www.example.com" ) );
515 $this->assertEquals( "name4=value2", $cj->serializeToHttpRequest( "/path/", "www.example.com" ) );
517 $h[] = "name5=value3; domain=.example.com; path=/path/; expires=Mon, 09-Dec-2029 13:46:00 GMT";
518 $cj->parseCookieResponseHeader( $h[2], "www.example.com" );
519 $this->assertEquals( "name4=value2; name5=value3", $cj->serializeToHttpRequest( "/path/", "www.example.com" ) );
521 $h[] = "name6=value3; domain=.example.net; path=/path/; expires=Mon, 09-Dec-2029 13:46:00 GMT";
522 $cj->parseCookieResponseHeader( $h[3], "www.example.com" );
523 $this->assertEquals( "", $cj->serializeToHttpRequest( "/path/", "www.example.net" ) );
525 $h[] = "name6=value0; domain=.example.net; path=/path/; expires=Mon, 09-Dec-1999 13:46:00 GMT";
526 $cj->parseCookieResponseHeader( $h[4], "www.example.net" );
527 $this->assertEquals( "", $cj->serializeToHttpRequest( "/path/", "www.example.net" ) );
529 $h[] = "name6=value4; domain=.example.net; path=/path/; expires=Mon, 09-Dec-2029 13:46:00 GMT";
530 $cj->parseCookieResponseHeader( $h[5], "www.example.net" );
531 $this->assertEquals( "name6=value4", $cj->serializeToHttpRequest( "/path/", "www.example.net" ) );
534 function runCookieRequests() {
535 $r = MWHttpRequest
::factory( "http://www.php.net/manual", array( 'followRedirects' => true ) );
538 $jar = $r->getCookieJar();
539 $this->assertThat( $jar, $this->isInstanceOf( 'CookieJar' ) );
541 if ( $r instanceof PhpHttpRequest
&& version_compare( '5.1.7', phpversion(), '>' ) ) {
542 $this->markTestSkipped( 'Redirection fails or crashes PHP on 5.1.6 and prior' );
544 $serialized = $jar->serializeToHttpRequest( "/search?q=test", "www.php.net" );
545 $this->assertRegExp( '/\bCOUNTRY=[^=;]+/', $serialized );
546 $this->assertRegExp( '/\bLAST_LANG=[^=;]+/', $serialized );
547 $this->assertEquals( '', $jar->serializeToHttpRequest( "/search?q=test", "www.php.com" ) );
550 function testCookieRequestDefault() {
551 Http
::$httpEngine = false;
552 $this->runCookieRequests();
554 function testCookieRequestPhp() {
555 if ( !self
::$has_fopen ) {
556 $this->markTestIncomplete( "This test requires allow_url_fopen=true." );
559 Http
::$httpEngine = 'php';
560 $this->runCookieRequests();
562 function testCookieRequestCurl() {
563 if ( !self
::$has_curl ) {
564 $this->markTestIncomplete( "This test requires curl." );
567 Http
::$httpEngine = 'curl';
568 $this->runCookieRequests();