ci: add 8.1
[m6w6/ext-http] / tests / encstream018.phpt
1 --TEST--
2 encoding stream brotli with explicit flush
3 --SKIPIF--
4 <?php
5 include "skipif.inc";
6 class_exists("http\\Encoding\\Stream\\Enbrotli") or die("SKIP need brotli support");
7 ?>
8 --FILE--
9 <?php
10 echo "Test\n";
11
12 $enc = new http\Encoding\Stream\Enbrotli;
13 $dec = new http\Encoding\Stream\Debrotli;
14 $file = file(__FILE__);
15 $data = "";
16 foreach ($file as $line) {
17 $data .= $dec->flush();
18 if (strlen($temp = $enc->update($line))) {
19 $data .= $dec->update($temp);
20 $data .= $dec->flush();
21 }
22 if (strlen($temp = $enc->flush())) {
23 $data .= $dec->update($temp);
24 $data .= $dec->flush();
25 }
26 }
27 if (strlen($temp = $enc->finish())) {
28 $data .= $dec->update($temp);
29 }
30 var_dump($enc->done());
31 $data .= $dec->finish();
32 var_dump($dec->done());
33 var_dump(implode("", $file) === $data);
34
35 ?>
36 DONE
37 --EXPECT--
38 Test
39 bool(true)
40 bool(true)
41 bool(true)
42 DONE