From: Raghubansh Kumar Date: Fri, 2 Nov 2007 03:16:22 +0000 (+0000) Subject: fix tests: proper temp file names X-Git-Tag: php-5.2.5~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5302a164b1c8799267ee5212e57f40a10f52708e;p=php fix tests: proper temp file names --- diff --git a/ext/standard/tests/file/fileinode_variation.phpt b/ext/standard/tests/file/fileinode_variation.phpt index 8ea9d3a21f..1f48d22491 100644 --- a/ext/standard/tests/file/fileinode_variation.phpt +++ b/ext/standard/tests/file/fileinode_variation.phpt @@ -5,6 +5,7 @@ Test fileinode() function: Variations if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip no link()/symlink() on Windows'); } +?> --FILE-- --FILE-- @@ -17,39 +17,44 @@ Description: Returns the type of the file. Possible values are fifo, char, dir, block, link, file, and unknown. */ -include "file.inc"; - echo "*** Testing filetype() with various types ***\n"; +$file_path = dirname(__FILE__); +$file1 = $file_path."/filetype1_variation.tmp"; +$file2 = $file_path."/filetype2_variation.tmp"; +$file3 = $file_path."/filetype3_variation.tmp"; +$link1 = $file_path."/filetype1_variation_link.tmp"; +$link2 = $file_path."/filetype2_variation_link.tmp"; -create_files( dirname(__FILE__), 2); +fclose( fopen($file1, "w") ); +fclose( fopen($file2, "w") ); echo "-- Checking with files --\n"; -print( filetype( dirname(__FILE__)."/file1.tmp") )."\n"; -print( filetype( dirname(__FILE__)."/file2.tmp") )."\n"; +print( filetype($file1) )."\n"; +print( filetype($file2) )."\n"; clearstatcache(); echo "-- Checking with links: hardlink --\n"; -link( dirname(__FILE__)."/file1.tmp", dirname(__FILE__)."/link1.tmp"); -print( filetype( dirname(__FILE__)."/link1.tmp" ) )."\n"; +link( $file1, $link1); +print( filetype($link1 ) )."\n"; echo "-- Checking with links: symlink --\n"; -symlink( dirname(__FILE__)."/file2.tmp", dirname(__FILE__)."/link2.tmp"); -print( filetype( dirname(__FILE__)."/link2.tmp") )."\n"; +symlink( $file2, $link2); +print( filetype($link2) )."\n"; -delete_files( dirname(__FILE__), 2, "link"); +unlink($link1); +unlink($link2); +unlink($file1); +unlink($file2); -delete_files( dirname(__FILE__), 2, "file"); - -$file_path = dirname(__FILE__); echo "-- Checking with directory --\n"; -mkdir("$file_path/temp"); -print( filetype("$file_path/temp") )."\n"; -rmdir( "$file_path/temp" ); +mkdir("$file_path/filetype_variation"); +print( filetype("$file_path/filetype_variation") )."\n"; +rmdir( "$file_path/filetype_variation" ); echo "-- Checking with fifo --\n"; -posix_mkfifo( dirname(__FILE__)."/file3.tmp", 0755); -print( filetype( dirname(__FILE__)."/file3.tmp") )."\n"; -delete_files( dirname(__FILE__), 1, "file", 3); +posix_mkfifo( $file3, 0755); +print( filetype( $file3) )."\n"; +unlink($file3); /* Checking with block in file */ /* To test this PEAR package should be installed */