- add another stream filter test
authorMichael Wallner <mike@php.net>
Fri, 30 Dec 2005 16:06:06 +0000 (16:06 +0000)
committerMichael Wallner <mike@php.net>
Fri, 30 Dec 2005 16:06:06 +0000 (16:06 +0000)
tests/stream_filters_003.phpt [new file with mode: 0644]

diff --git a/tests/stream_filters_003.phpt b/tests/stream_filters_003.phpt
new file mode 100644 (file)
index 0000000..9e2e48f
--- /dev/null
@@ -0,0 +1,42 @@
+--TEST--
+stream filter fun
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkmin(5);
+skipif(!http_support(HTTP_SUPPORT_ENCODINGS), "need zlib");
+?>
+--FILE--
+<?php
+echo "-TEST\n";
+
+define('OUT', fopen('php://output', 'w'));
+
+stream_filter_append(OUT, 'http.chunked_encode');
+stream_filter_append(OUT, 'http.deflate');
+stream_filter_append(OUT, 'http.chunked_encode');
+stream_filter_append(OUT, 'http.deflate');
+stream_filter_append(OUT, 'http.inflate');
+stream_filter_append(OUT, 'http.chunked_decode');
+stream_filter_append(OUT, 'http.inflate');
+stream_filter_append(OUT, 'http.chunked_decode');
+
+$text = <<<SOME_TEXT
+This is some stream filter fun; we'll see if it bails out or not.
+The text should come out at the other end of the stream exactly like written to it.
+Go figure!
+SOME_TEXT;
+
+srand(time());
+foreach (str_split($text, 5) as $part) {
+       fwrite(OUT, $part);
+       if (rand(0, 1)) {
+               fflush(OUT);
+       }
+}
+?>
+--EXPECTF--
+%sTEST
+This is some stream filter fun; we'll see if it bails out or not.
+The text should come out at the other end of the stream exactly like written to it.
+Go figure!