gzencode_variation2-win32.phpt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --TEST--
  2. Test gzencode() function : variation - verify header contents with all encoding modes
  3. --SKIPIF--
  4. <?php
  5. if( substr(PHP_OS, 0, 3) != "WIN" ) {
  6. die("skip.. only for Windows");
  7. }
  8. if (!extension_loaded("zlib")) {
  9. print "skip - ZLIB extension not loaded";
  10. }
  11. include 'func.inc';
  12. if (version_compare(get_zlib_version(), "1.2.11") < 0) {
  13. die("skip - at least zlib 1.2.11 required, got " . get_zlib_version());
  14. }
  15. ?>
  16. --FILE--
  17. <?php
  18. /* Prototype : string gzencode ( string $data [, int $level [, int $encoding_mode ]] )
  19. * Description: Gzip-compress a string
  20. * Source code: ext/zlib/zlib.c
  21. * Alias to functions:
  22. */
  23. echo "*** Testing gzencode() : variation ***\n";
  24. $data = "A small string to encode\n";
  25. echo "\n-- Testing with each encoding_mode --\n";
  26. var_dump(bin2hex(gzencode($data, -1)));
  27. var_dump(bin2hex(gzencode($data, -1, FORCE_GZIP)));
  28. var_dump(bin2hex(gzencode($data, -1, FORCE_DEFLATE)));
  29. ?>
  30. ===DONE===
  31. --EXPECT--
  32. *** Testing gzencode() : variation ***
  33. -- Testing with each encoding_mode --
  34. string(90) "1f8b080000000000000a735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000"
  35. string(90) "1f8b080000000000000a735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000"
  36. string(66) "789c735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200735808cd"
  37. ===DONE===