fixed a bug with multiple ob_start() on http\Env\Response while replacing it's body
[m6w6/ext-http] / tests / envresponse015.phpt
diff --git a/tests/envresponse015.phpt b/tests/envresponse015.phpt
new file mode 100644 (file)
index 0000000..abad2bb
--- /dev/null
@@ -0,0 +1,36 @@
+--TEST--
+env response send replaced body using multiple ob_start
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--FILE--
+<?php
+
+$r = new http\Env\Response;
+
+ob_start($r);
+echo "bar";
+ob_end_flush();
+
+$b = $r->getBody();
+$r->setBody(new http\Message\Body);
+
+ob_start($r);
+echo "foo: $b\n";
+ob_end_flush();
+
+$f = fopen("php://memory", "r+");
+
+$r->send($f);
+
+fseek($f, 0, SEEK_SET);
+echo stream_get_contents($f);
+
+?>
+--EXPECT--
+HTTP/1.1 200 OK
+Accept-Ranges: bytes
+ETag: "fc8305a1"
+
+foo: bar