fix tests
[m6w6/ext-http] / tests / client011.phpt
index 59097420c72f5b35d63469a9d3fa588f4ed231af..b1214c440c0d8d674c9af21251fa8880a5c52f1a 100644 (file)
@@ -3,72 +3,68 @@ client history
 --SKIPIF--
 <?php 
 include "skipif.inc";
-skip_online_test();
 skip_client_test();
 ?>
 --FILE--
 <?php 
 
-echo "Test\n";
+include "helper/server.inc";
 
-$body = new http\Message\Body;
-$body->append("foobar");
+echo "Test\n";
 
-$request = new http\Client\Request;
-$request->setBody($body);
-$request->setRequestMethod("POST");
-$request->setRequestUrl("http://dev.iworks.at/ext-http/.print_request.php");
+server("env.inc", function($port) {
+       $body = new http\Message\Body;
+       $body->append("foobar");
 
-$client = new http\Client;
-$client->recordHistory = true;
+       $request = new http\Client\Request;
+       $request->setBody($body);
+       $request->setRequestMethod("POST");
+       $request->setRequestUrl("http://localhost:$port");
 
-$client->enqueue($request)->send();
-echo $client->getHistory()->toString(true);
+       $client = new http\Client;
+       $client->recordHistory = true;
 
-$client->requeue($request)->send();
-echo $client->getHistory()->toString(true);
+       $client->enqueue($request)->send();
+       echo $client->getHistory()->toString(true);
 
+       $client->requeue($request)->send();
+       echo $client->getHistory()->toString(true);
+});
 ?>
 Done
 --EXPECTF--
 Test
-POST http://dev.iworks.at/ext-http/.print_request.php HTTP/1.1
+POST http://localhost:%d/ HTTP/1.1
 Content-Length: 6
 
 foobar
 HTTP/1.1 200 OK
-Vary: %s
-Content-Type: text/html
-Date: %s
-Server: %s
+Accept-Ranges: bytes
+X-Request-Content-Length: 6
 X-Original-Transfer-Encoding: chunked
 Content-Length: 19
 
 string(6) "foobar"
 
-POST http://dev.iworks.at/ext-http/.print_request.php HTTP/1.1
+POST http://localhost:%d/ HTTP/1.1
 Content-Length: 6
 
 foobar
 HTTP/1.1 200 OK
-Vary: %s
-Content-Type: text/html
-Date: %s
-Server: %s
+Accept-Ranges: bytes
+X-Request-Content-Length: 6
 X-Original-Transfer-Encoding: chunked
 Content-Length: 19
 
 string(6) "foobar"
 
-POST http://dev.iworks.at/ext-http/.print_request.php HTTP/1.1
+POST http://localhost:%d/ HTTP/1.1
 Content-Length: 6
 
 foobar
 HTTP/1.1 200 OK
-Vary: %s
-Content-Type: text/html
-Date: %s
-Server: %s
+Accept-Ranges: bytes
+X-Request-Content-Length: 6
 X-Original-Transfer-Encoding: chunked
 Content-Length: 19