gzfile_variation15.phpt [plain text]
--TEST--
Test gzfile() function : variation: use include path (relative directories in path)
--SKIPIF--
<?php
if (!extension_loaded("zlib")) {
print "skip - ZLIB extension not loaded";
}
?>
--FILE--
<?php
require_once('reading_include_path.inc');
set_include_path($newIncludePath);
test_gzfile();
restore_include_path();
chdir($baseDir);
rmdir($workingDir);
foreach($newdirs as $newdir) {
rmdir($newdir);
}
chdir("..");
rmdir($thisTestDir);
function test_gzfile() {
global $scriptFile, $secondFile, $firstFile, $filename;
$h = gzopen($secondFile, "w");
gzwrite($h, "This is a file in dir2");
gzclose($h);
var_dump(gzfile($filename, true));
echo "\n";
$h = gzopen($firstFile, "w");
gzwrite($h, "This is a file in dir1");
gzclose($h);
var_dump(gzfile($filename, true));
echo "\n";
$h = gzopen($filename, "w");
gzwrite($h, "This is a file in working dir");
gzclose($h);
var_dump(gzfile($filename, true));
echo "\n";
unlink($firstFile);
unlink($secondFile);
var_dump(gzfile($filename, true));
echo "\n";
$h = gzopen($scriptFile, "w");
gzwrite($h, "This is a file in script dir");
gzclose($h);
var_dump(gzfile($filename, true));
echo "\n";
unlink($filename);
unlink($scriptFile);
}
?>
===DONE===
--EXPECTF--
array(1) {
[0]=>
string(22) "This is a file in dir2"
}
array(1) {
[0]=>
string(22) "This is a file in dir1"
}
array(1) {
[0]=>
string(22) "This is a file in dir1"
}
array(1) {
[0]=>
string(29) "This is a file in working dir"
}
array(1) {
[0]=>
string(28) "This is a file in script dir"
}
===DONE===