1--TEST--
2encoding stream chunked flush
3--SKIPIF--
4<?php
5include "skipif.inc";
6?>
7--FILE--
8<?php
9echo "Test\n";
10
11$dech = new http\Encoding\Stream\Dechunk(http\Encoding\Stream::FLUSH_FULL);
12$file = file(__FILE__);
13$data = "";
14foreach ($file as $i => $line) {
15	$dech = clone $dech;
16	if ($i % 2) {
17		$data .= $dech->update(sprintf("%lx\r\n%s\r\n", strlen($line), $line));
18	} else {
19		$data .= $dech->update(sprintf("%lx\r\n", strlen($line)));
20		$data .= $dech->flush();
21		$data .= $dech->update($line);
22		$data .= $dech->flush();
23		$data .= $dech->update("\r\n");
24	}
25	$dech->flush();
26	$dech->done() and printf("uh-oh done() reported true!\n");
27}
28$data .= $dech->update("0\r\n");
29var_dump($dech->done());
30$data .= $dech->finish();
31var_dump(implode("", $file) === $data);
32?>
33DONE
34--EXPECT--
35Test
36bool(true)
37bool(true)
38DONE
39