readfile_variation2.phpt [plain text]
--TEST--
Test readfile() function: usage variations - links
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip.. only on Linux');
}
?>
--FILE--
<?php
require("file.inc");
$file_path = dirname(__FILE__);
$filename = "$file_path/readfile_variation2.tmp";
$fp = fopen($filename, "w");
fill_file($fp, "text_with_new_line", 50);
fclose($fp);
$linkname = "$file_path/readfile_variation2_link.tmp";
echo "*** Testing readfile() on soft link ***\n";
var_dump( symlink($filename, $linkname) );
$count = readfile($linkname); echo "\n";
var_dump($count);
unlink($linkname);
echo "\n*** Testing readfile() on hard link ***\n";
var_dump( link($filename, $linkname) );
$count = readfile($linkname); echo "\n";
var_dump($count);
unlink($linkname);
echo "Done\n";
?>
--CLEAN--
<?php
$file_path = dirname(__FILE__);
unlink("$file_path/readfile_variation2.tmp");
?>
--EXPECTF--
*** Testing readfile() on soft link ***
bool(true)
line
line of text
line
line of text
line
line of t
int(50)
*** Testing readfile() on hard link ***
bool(true)
line
line of text
line
line of text
line
line of t
int(50)
Done