1--TEST--
2Test gzcompress() function : basic functionality
3--EXTENSIONS--
4zlib
5--SKIPIF--
6<?php if (getenv('TRAVIS')) die('skip Currently fails on Travis'); ?>
7--FILE--
8<?php
9/*
10 * add a comment here to say what the test is supposed to do
11 */
12
13include(__DIR__ . '/data.inc');
14
15echo "*** Testing gzcompress() : basic functionality ***\n";
16
17// Initialise all required variables
18
19$smallstring = "A small string to compress\n";
20
21
22// Calling gzcompress() with all possible arguments
23
24// Compressing a big string
25for($i = -1; $i < 10; $i++) {
26    echo "-- Compression level $i --\n";
27    $output = gzcompress($data, $i);
28    var_dump(strcmp(gzuncompress($output), $data));
29}
30
31// Compressing a smaller string
32for($i = -1; $i < 10; $i++) {
33    echo "-- Compression level $i --\n";
34    $output = gzcompress($smallstring, $i);
35    var_dump(strcmp(gzuncompress($output), $smallstring));
36}
37
38// Calling gzcompress() with mandatory arguments
39echo "\n-- Testing with no specified compression level --\n";
40$output = gzcompress($smallstring);
41 var_dump(strcmp(gzuncompress($output), $smallstring));
42
43?>
44--EXPECT--
45*** Testing gzcompress() : basic functionality ***
46-- Compression level -1 --
47int(0)
48-- Compression level 0 --
49int(0)
50-- Compression level 1 --
51int(0)
52-- Compression level 2 --
53int(0)
54-- Compression level 3 --
55int(0)
56-- Compression level 4 --
57int(0)
58-- Compression level 5 --
59int(0)
60-- Compression level 6 --
61int(0)
62-- Compression level 7 --
63int(0)
64-- Compression level 8 --
65int(0)
66-- Compression level 9 --
67int(0)
68-- Compression level -1 --
69int(0)
70-- Compression level 0 --
71int(0)
72-- Compression level 1 --
73int(0)
74-- Compression level 2 --
75int(0)
76-- Compression level 3 --
77int(0)
78-- Compression level 4 --
79int(0)
80-- Compression level 5 --
81int(0)
82-- Compression level 6 --
83int(0)
84-- Compression level 7 --
85int(0)
86-- Compression level 8 --
87int(0)
88-- Compression level 9 --
89int(0)
90
91-- Testing with no specified compression level --
92int(0)
93