ci: enable ext/intl
[awesomized/ext-ion] / tests / LOB / RW.phpt
1 --TEST--
2 ion\LOB/RW
3 --EXTENSIONS--
4 ion
5 --FILE--
6 TEST
7 <?php
8 $s = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
9 array_map(fn($s)=>stream_set_blocking($s,false), $s);
10
11 $w = new ion\Writer\Stream\Writer($s[0]);
12 $w->startLob(ion\Type::CLob);
13 $w->appendLob(str_repeat("a", 0x1000));
14
15 $l = 0;
16 $r = new ion\Reader\Stream\Reader($s[1]);
17 for ($i = 0; $i < 10; $i++) {
18 $W=$E=[];
19 for ($R=[$s[1]]; stream_select($R, $W, $E, 0); ) {
20 if ($r->getType() != ion\Type::CLob)
21 $r->next();
22 echo "+";
23 $r->readLobPart($b);
24 $l += strlen($b);
25 }
26 echo "-";
27 $w->appendLob(str_repeat("a", 0x1000));
28 }
29
30 $w->finishLob();
31 $w->finish();
32
33 while ($r->readLobPart($b)) {
34 echo ".";
35 $l += strlen($b);
36 }
37 echo "\n";
38
39 $r->next();
40 var_dump($r->key(), $l);
41 ?>
42 DONE
43 --EXPECTF--
44 TEST
45 %r[-+]+\.+%r
46 enum(ion\Type::EOF)
47 int(45056)
48 DONE