]> granicus.if.org Git - php/commitdiff
New gzencode() test. php6 tets fails currentlly due to #47178. Tested on Windows...
authorandy wharmby <wharmby@php.net>
Wed, 21 Jan 2009 11:39:14 +0000 (11:39 +0000)
committerandy wharmby <wharmby@php.net>
Wed, 21 Jan 2009 11:39:14 +0000 (11:39 +0000)
ext/zlib/tests/gzencode_variation2.phpt [new file with mode: 0644]

diff --git a/ext/zlib/tests/gzencode_variation2.phpt b/ext/zlib/tests/gzencode_variation2.phpt
new file mode 100644 (file)
index 0000000..901cd53
--- /dev/null
@@ -0,0 +1,36 @@
+--TEST--
+Test gzencode() function : variation - verify header contents with all encoding modes
+--SKIPIF--
+<?php 
+
+if (!extension_loaded("zlib")) {
+       print "skip - ZLIB extension not loaded"; 
+}       
+?> 
+--FILE--
+<?php
+/* Prototype  : string gzencode  ( string $data  [, int $level  [, int $encoding_mode  ]] )
+ * Description: Gzip-compress a string 
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing gzencode() : variation ***\n";
+
+$data = "A small string to encode\n";
+
+echo "\n-- Testing with each encoding_mode  --\n";
+var_dump(bin2hex(gzencode($data, -1)));
+var_dump(bin2hex(gzencode($data, -1, FORCE_GZIP)));  
+var_dump(bin2hex(gzencode($data, -1, FORCE_DEFLATE)));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gzencode() : variation ***
+
+-- Testing with each encoding_mode  --
+string(90) "1f8b0800000000000003735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000"
+string(90) "1f8b0800000000000003735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000"
+string(86) "1f8b0800000000000003789c735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200735808cd"
+===DONE===
\ No newline at end of file