1--TEST--
2Test readgzfile() function : variation: use include path (relative directories in path)
3--EXTENSIONS--
4zlib
5--FILE--
6<?php
7$testName = 'readgzfile_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_readgzfile();
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_readgzfile() {
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   echo "file content:";
34   readgzfile($filename, true);
35   echo "\n";
36
37   //create a file in dir1
38   $h = gzopen($firstFile, "w");
39   gzwrite($h, "This is a file in dir1");
40   gzclose($h);
41
42   //should now read dir1 file
43   echo "file content:";
44   readgzfile($filename, true);
45   echo "\n";
46
47   // create a file in working directory
48   $h = gzopen($filename, "w");
49   gzwrite($h, "This is a file in working dir");
50   gzclose($h);
51
52   //should still read dir1 file
53   echo "file content:";
54   readgzfile($filename, true);
55   echo "\n";
56
57   unlink($firstFile);
58   unlink($secondFile);
59
60   //should read the file in working dir
61   echo "file content:";
62   readgzfile($filename, true);
63   echo "\n";
64
65   // create a file in the script directory
66   $h = gzopen($scriptFile, "w");
67   gzwrite($h, "This is a file in script dir");
68   gzclose($h);
69
70   //should read the file in script dir
71   echo "file content:";
72   readgzfile($filename, true);
73   echo "\n";
74
75   //cleanup
76   unlink($filename);
77   unlink($scriptFile);
78
79}
80
81?>
82--EXPECT--
83file content:This is a file in dir2
84file content:This is a file in dir1
85file content:This is a file in dir1
86file content:This is a file in working dir
87file content:This is a file in script dir
88