Skip to content

Commit a8948d0

Browse files
committed
split gzgetc_basic.phpt for zlib 1.2.7
1 parent 592917f commit a8948d0

File tree

3 files changed

+66
-2
lines changed

3 files changed

+66
-2
lines changed

ext/zlib/tests/func.inc

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
function get_zlib_version()
4+
{
5+
$version = NULL;
6+
7+
ob_start();
8+
phpinfo();
9+
$info = ob_get_contents();
10+
ob_end_clean();
11+
if (preg_match(',zlib.*Compiled Version => (\d+\.\d+\.\d+),s', $info, $match)) {
12+
$version = $match[1];
13+
}
14+
15+
return $version;
16+
}
17+

ext/zlib/tests/gzgetc_basic.phpt

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
--TEST--
2-
Test function gzgetc() by calling it with its expected arguments
2+
Test function gzgetc() by calling it with its expected arguments zlib 1.2.5
33
--SKIPIF--
44
<?php
55
if (!extension_loaded("zlib")) {
66
print "skip - ZLIB extension not loaded";
77
}
8+
include 'func.inc';
9+
if (version_compare(get_zlib_version(), '1.2.5') > 0) {
10+
die('skip - only for zlib <= 1.2.5');
11+
}
812
?>
913
--FILE--
1014
<?php
@@ -35,4 +39,4 @@ as it turns around
3539
and I know that it descends down on me
3640

3741
characters counted=176
38-
===DONE===
42+
===DONE===

ext/zlib/tests/gzgetc_basic_1.phpt

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
--TEST--
2+
Test function gzgetc() by calling it with its expected arguments zlib 1.2.7
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded("zlib")) {
6+
print "skip - ZLIB extension not loaded";
7+
}
8+
include 'func.inc';
9+
if (version_compare(get_zlib_version(), '1.2.7') < 0) {
10+
die('skip - only for zlib >= 1.2.7');
11+
}
12+
?>
13+
--FILE--
14+
<?php
15+
16+
// note that gzgets is an alias to fgets. parameter checking tests will be
17+
// the same as gzgets
18+
19+
$f = dirname(__FILE__)."/004.txt.gz";
20+
$h = gzopen($f, 'r');
21+
if ($h) {
22+
$count = 0;
23+
while (($c = fgetc( $h )) !== false) {
24+
$count++;
25+
echo $c;
26+
}
27+
28+
echo "\ncharacters counted=$count\n";
29+
gzclose($h);
30+
}
31+
32+
?>
33+
===DONE===
34+
--EXPECT--
35+
When you're taught through feelings
36+
Destiny flying high above
37+
all I know is that you can realize it
38+
Destiny who cares
39+
as it turns around
40+
and I know that it descends down on me
41+
42+
characters counted=176
43+
===DONE===

0 commit comments

Comments
 (0)