gzopen_variation5.phpt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. --TEST--
  2. Test gzopen() function : variation: use include path and stream context create a file, relative path
  3. --EXTENSIONS--
  4. zlib
  5. --FILE--
  6. <?php
  7. require_once('gzopen_include_path.inc');
  8. echo "*** Testing gzopen() : variation ***\n";
  9. $thisTestDir = "gzopenVariation5.dir";
  10. mkdir($thisTestDir);
  11. chdir($thisTestDir);
  12. $newpath = relative_include_path();
  13. set_include_path($newpath);
  14. runtest();
  15. $newpath = generate_next_rel_path();
  16. set_include_path($newpath);
  17. runtest();
  18. teardown_relative_path();
  19. chdir("..");
  20. rmdir($thisTestDir);
  21. function runtest() {
  22. $tmpfile = 'gzopen_variation5.tmp';
  23. $h = gzopen($tmpfile, "w", true);
  24. fwrite($h, "This is the test file");
  25. fclose($h);
  26. $h = @gzopen($tmpfile, "r");
  27. if ($h === false) {
  28. echo "Not created in working dir\n";
  29. }
  30. else {
  31. echo "created in working dir\n";
  32. gzclose($h);
  33. unlink($tmpfile);
  34. }
  35. $h = @gzopen('dir1/'.$tmpfile, "r");
  36. if ($h === false) {
  37. echo "Not created in dir1\n";
  38. }
  39. else {
  40. echo "created in dir1\n";
  41. gzclose($h);
  42. unlink('dir1/'.$tmpfile);
  43. }
  44. }
  45. ?>
  46. --EXPECT--
  47. *** Testing gzopen() : variation ***
  48. created in working dir
  49. Not created in dir1
  50. created in working dir
  51. Not created in dir1