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