Fix gh-issue #16
[m6w6/ext-http] / tests / bug66388.phpt
index ac0bff336d4e9b39f6ed3a5cd4fe9a9f1142e19f..77d50c7349384823b71ed5f7272a343a2ca1cdd6 100644 (file)
@@ -1,8 +1,9 @@
 --TEST--
 Bug #66388 (Crash on POST with Content-Length:0 and untouched body)
 --SKIPIF--
-<?php php
+<?php
 include "skipif.inc";
+skip_online_test();
 ?>
 --FILE--
 <?php
@@ -10,23 +11,27 @@ include "skipif.inc";
 use http\Client,
        http\Client\Request;
 
+include "helper/server.inc";
+
 echo "Test\n";
 
-$client = new Client();
-$request = new Request(
-       'POST',
-       'https://api.twitter.com/oauth/request_token',
-       array(
-               'Content-Length' => 0
-       )
-);
-$client->enqueue($request);
-echo $client->send()->getResponse()->getResponseCode();
+server("proxy.inc", function($port) {
+       $client = new Client();
+       $request = new Request(
+               'POST',
+               "http://localhost:$port/",
+               array(
+                       'Content-Length' => 0
+               )
+       );
+       $client->enqueue($request);
+       echo $client->send()->getResponse()->getResponseCode();
+});
 
 ?>
 
 ===DONE===
---EXPECT--
+--EXPECTF--
 Test
-401
+200
 ===DONE===