let DEV_2 be trunk
[m6w6/ext-http] / tests / envresponse007.phpt
diff --git a/tests/envresponse007.phpt b/tests/envresponse007.phpt
new file mode 100644 (file)
index 0000000..5495fe2
--- /dev/null
@@ -0,0 +1,39 @@
+--TEST--
+env response env request
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--GET--
+dummy=1
+--FILE--
+<?php
+echo "Test\n";
+
+$tmp = tmpfile();
+
+// modify HTTP env
+$req = new http\Env\Request;
+$req->setHeader("Range", "bytes=2-4");
+
+$res = new http\Env\Response;
+$res->setEnvRequest($req);
+$res->setContentType("text/plain");
+$res->getBody()->append("012345679");
+$res->send($tmp);
+
+rewind($tmp);
+var_dump(stream_get_contents($tmp));
+
+?>
+Done
+--EXPECTF--
+Test
+string(%d) "HTTP/1.1 206 Partial Content%c
+Accept-Ranges: bytes%c
+X-Powered-By: %s%c
+Content-Type: text/plain%c
+Content-Range: bytes 2-4/9%c
+%c
+234"
+Done