gzfile_variation15.phpt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. --TEST--
  2. Test gzfile() function : variation: use include path (relative directories in path)
  3. --EXTENSIONS--
  4. zlib
  5. --FILE--
  6. <?php
  7. $testName = 'gzfile_variation15';
  8. require_once('reading_include_path.inc');
  9. //define the files to go into these directories, create one in dir2
  10. set_include_path($newIncludePath);
  11. test_gzfile();
  12. // remove the directory structure
  13. chdir($baseDir);
  14. rmdir($workingDir);
  15. foreach($newdirs as $newdir) {
  16. rmdir($newdir);
  17. }
  18. chdir("..");
  19. rmdir($thisTestDir);
  20. function test_gzfile() {
  21. global $scriptFile, $secondFile, $firstFile, $filename;
  22. // create a file in the middle directory
  23. $h = gzopen($secondFile, "w");
  24. gzwrite($h, "This is a file in dir2");
  25. gzclose($h);
  26. // should read dir2 file
  27. var_dump(gzfile($filename, true));
  28. echo "\n";
  29. //create a file in dir1
  30. $h = gzopen($firstFile, "w");
  31. gzwrite($h, "This is a file in dir1");
  32. gzclose($h);
  33. //should now read dir1 file
  34. var_dump(gzfile($filename, true));
  35. echo "\n";
  36. // create a file in working directory
  37. $h = gzopen($filename, "w");
  38. gzwrite($h, "This is a file in working dir");
  39. gzclose($h);
  40. //should still read dir1 file
  41. var_dump(gzfile($filename, true));
  42. echo "\n";
  43. unlink($firstFile);
  44. unlink($secondFile);
  45. //should read the file in working directory
  46. var_dump(gzfile($filename, true));
  47. echo "\n";
  48. // create a file in the script directory
  49. $h = gzopen($scriptFile, "w");
  50. gzwrite($h, "This is a file in script dir");
  51. gzclose($h);
  52. //should read the file in script dir
  53. var_dump(gzfile($filename, true));
  54. echo "\n";
  55. //cleanup
  56. unlink($filename);
  57. unlink($scriptFile);
  58. }
  59. ?>
  60. --EXPECT--
  61. array(1) {
  62. [0]=>
  63. string(22) "This is a file in dir2"
  64. }
  65. array(1) {
  66. [0]=>
  67. string(22) "This is a file in dir1"
  68. }
  69. array(1) {
  70. [0]=>
  71. string(22) "This is a file in dir1"
  72. }
  73. array(1) {
  74. [0]=>
  75. string(29) "This is a file in working dir"
  76. }
  77. array(1) {
  78. [0]=>
  79. string(28) "This is a file in script dir"
  80. }