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