kraghuba Fri Nov 2 03:11:00 2007 UTC Modified files: /php-src/ext/standard/tests/file filetype_variation.phpt fileinode_variation.phpt Log: fix tests: proper temp file names http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/filetype_variation.phpt?r1=1.5&r2=1.6&diff_format=u Index: php-src/ext/standard/tests/file/filetype_variation.phpt diff -u php-src/ext/standard/tests/file/filetype_variation.phpt:1.5 php-src/ext/standard/tests/file/filetype_variation.phpt:1.6 --- php-src/ext/standard/tests/file/filetype_variation.phpt:1.5 Tue Jun 5 11:32:45 2007 +++ php-src/ext/standard/tests/file/filetype_variation.phpt Fri Nov 2 03:11:00 2007 @@ -6,7 +6,7 @@ die('skip no link()/symlink() on Windows'); } if (!function_exists("posix_mkfifo")) { - die("skip no posix_mkfifo()"); + die("skip no posix_mkfifo()"); } ?> --FILE-- @@ -17,39 +17,44 @@ 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 */ http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fileinode_variation.phpt?r1=1.5&r2=1.6&diff_format=u Index: php-src/ext/standard/tests/file/fileinode_variation.phpt diff -u php-src/ext/standard/tests/file/fileinode_variation.phpt:1.5 php-src/ext/standard/tests/file/fileinode_variation.phpt:1.6 --- php-src/ext/standard/tests/file/fileinode_variation.phpt:1.5 Tue Jun 5 11:32:45 2007 +++ php-src/ext/standard/tests/file/fileinode_variation.phpt Fri Nov 2 03:11:00 2007 @@ -13,45 +13,52 @@ Description: Returns the inode number of the file, or FALSE in case of an error. */ -include "file.inc"; - echo "*** Testing fileinode() with files, links and directories ***\n"; +$file_path = dirname(__FILE__); +$file1 = $file_path."/fileinode1_variation.tmp"; +$file2 = $file_path."/fileinode2_variation.tmp"; +$link1 = $file_path."/fileinode1_variation_link.tmp"; +$link2 = $file_path."/fileinode2_variation_link.tmp"; + echo "-- Testing with files --\n"; -create_files( dirname(__FILE__), 2); +//creating the files +fclose( fopen( $file1, "w" ) ); +fclose( fopen( $file2, "w" ) ); -print( fileinode( dirname(__FILE__)."/file1.tmp") )."\n"; -print( fileinode( dirname(__FILE__)."/file2.tmp") )."\n"; +print( fileinode( $file1) )."\n"; +print( fileinode( $file2) )."\n"; clearstatcache(); echo "-- Testing with links: hard link --\n"; -link( dirname(__FILE__)."/file1.tmp", dirname(__FILE__)."/link1.tmp"); // Creating an hard link -print( fileinode( dirname(__FILE__)."/file1.tmp") )."\n"; +link( $file1, $link1); // Creating an hard link +print( fileinode( $file1) )."\n"; clearstatcache(); -print( fileinode( dirname(__FILE__)."/link1.tmp") )."\n"; +print( fileinode( $link1) )."\n"; clearstatcache(); echo "-- Testing with links: soft link --\n"; -symlink( dirname(__FILE__)."/file2.tmp", dirname(__FILE__)."/link2.tmp"); // Creating a soft link -print( fileinode( dirname(__FILE__)."/file2.tmp") )."\n"; +symlink( $file2, $link2); // Creating a soft link +print( fileinode( $file2) )."\n"; clearstatcache(); -print( fileinode( dirname(__FILE__)."/link2.tmp") )."\n"; +print( fileinode( $link2) )."\n"; -delete_files( dirname(__FILE__), 2, "link"); +unlink( $link1 ); +unlink( $link2 ); echo "-- Testing after copying a file --\n"; -copy( dirname(__FILE__)."/file1.tmp", dirname(__FILE__)."/file1_new.tmp"); -print( fileinode( dirname(__FILE__)."/file1.tmp") )."\n"; +copy( $file1, $file_path."/fileinode1_variation_new.tmp"); +print( fileinode( $file1) )."\n"; clearstatcache(); -print( fileinode( dirname(__FILE__)."/file1_new.tmp") )."\n"; +print( fileinode( $file_path."/fileinode1_variation_new.tmp") )."\n"; -unlink( dirname(__FILE__)."/file1_new.tmp"); +unlink( $file_path."/fileinode1_variation_new.tmp"); +unlink( $file1); +unlink( $file2); -delete_files( dirname(__FILE__), 2); echo "-- Testing after renaming the file --\n"; -$file_path = dirname(__FILE__); -fopen("$file_path/old.txt", "w"); +fclose( fopen("$file_path/old.txt", "w") ); print( fileinode("$file_path/old.txt") )."\n"; clearstatcache(); @@ -70,16 +77,15 @@ clearstatcache(); echo "-- Testing with binary input --\n"; -print( fileinode("$file_path/dir") )."\n"; +print( fileinode(b"$file_path/dir") )."\n"; clearstatcache(); -print( fileinode("$file_path/dir/subdir") ); - +print( fileinode(b"$file_path/dir/subdir") ); rmdir("$file_path/dir/subdir"); rmdir("$file_path/dir"); echo "\n*** Done ***"; -?> + --EXPECTF-- *** Testing fileinode() with files, links and directories *** -- Testing with files --
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php