1--TEST-- 2Test gzencode() 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 * Test basic function of gzencode 11 */ 12 13include(__DIR__ . '/data.inc'); 14 15echo "*** Testing gzencode() : basic functionality ***\n"; 16 17// Initialise all required variables 18 19$smallstring = "A small string to compress\n"; 20 21 22// Calling gzencode() with various compression levels 23 24// Compressing a big string 25for($i = -1; $i < 10; $i++) { 26 echo "-- Compression level $i --\n"; 27 $output = gzencode($data, $i); 28 var_dump(strcmp(gzdecode($output), $data)===0); 29} 30 31// Compressing a smaller string 32for($i = -1; $i < 10; $i++) { 33 echo "-- Compression level $i --\n"; 34 $output = gzencode($smallstring, $i); 35 var_dump(strcmp(gzdecode($output), $smallstring)===0); 36} 37 38// Calling gzencode() with mandatory arguments 39echo "\n-- Testing with no specified compression level --\n"; 40$output = gzencode($smallstring); 41var_dump(strcmp(gzdecode($output), $smallstring)===0); 42 43echo "\n-- Testing gzencode with mode specified --\n"; 44$outupt = gzencode($smallstring, -1, FORCE_GZIP); 45var_dump(strcmp(gzdecode($output), $smallstring)===0); 46?> 47--EXPECTF-- 48*** Testing gzencode() : basic functionality *** 49-- Compression level -1 -- 50bool(true) 51-- Compression level 0 -- 52bool(true) 53-- Compression level 1 -- 54bool(true) 55-- Compression level 2 -- 56bool(true) 57-- Compression level 3 -- 58bool(true) 59-- Compression level 4 -- 60bool(true) 61-- Compression level 5 -- 62bool(true) 63-- Compression level 6 -- 64bool(true) 65-- Compression level 7 -- 66bool(true) 67-- Compression level 8 -- 68bool(true) 69-- Compression level 9 -- 70bool(true) 71-- Compression level -1 -- 72bool(true) 73-- Compression level 0 -- 74bool(true) 75-- Compression level 1 -- 76bool(true) 77-- Compression level 2 -- 78bool(true) 79-- Compression level 3 -- 80bool(true) 81-- Compression level 4 -- 82bool(true) 83-- Compression level 5 -- 84bool(true) 85-- Compression level 6 -- 86bool(true) 87-- Compression level 7 -- 88bool(true) 89-- Compression level 8 -- 90bool(true) 91-- Compression level 9 -- 92bool(true) 93 94-- Testing with no specified compression level -- 95bool(true) 96 97-- Testing gzencode with mode specified -- 98bool(true) 99