xref: /PHP-8.1/ext/bz2/tests/003.phpt (revision 56f90492)
1--TEST--
2bzread() tests
3--EXTENSIONS--
4bz2
5--FILE--
6<?php
7
8$fd = bzopen(__DIR__."/003.txt.bz2","r");
9var_dump(bzread($fd, 0));
10
11try {
12    var_dump(bzread($fd, -10));
13} catch (\ValueError $e) {
14    echo $e->getMessage() . \PHP_EOL;
15}
16
17var_dump(bzread($fd, 1));
18var_dump(bzread($fd, 2));
19var_dump(bzread($fd, 100000));
20
21?>
22--EXPECT--
23string(0) ""
24bzread(): Argument #2 ($length) must be greater than or equal to 0
25string(1) "R"
26string(2) "is"
27string(251) "ing up from the heart of the desert
28Rising up for Jerusalem
29Rising up from the heat of the desert
30Building up Old Jerusalem
31Rising up from the heart of the desert
32Rising up for Jerusalem
33Rising up from the heat of the desert
34Heading out for Jerusalem
35"
36