kraghuba Fri Nov 2 03:14:10 2007 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard/tests/file fileinode_variation.phpt filetype_variation.phpt Log: fix tests: proper temp file names http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fileinode_variation.phpt?r1=1.1.2.2&r2=1.1.2.2.2.1&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.1.2.2 php-src/ext/standard/tests/file/fileinode_variation.phpt:1.1.2.2.2.1 --- php-src/ext/standard/tests/file/fileinode_variation.phpt:1.1.2.2 Tue Jun 5 11:35:04 2007 +++ php-src/ext/standard/tests/file/fileinode_variation.phpt Fri Nov 2 03:14:10 2007 @@ -5,6 +5,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip no link()/symlink() on Windows'); } +?> --FILE-- <?php /* @@ -12,46 +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"); - -delete_files( dirname(__FILE__), 2); +unlink( $file_path."/fileinode1_variation_new.tmp"); +unlink( $file1); +unlink( $file2); 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(); http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/filetype_variation.phpt?r1=1.1.2.3&r2=1.1.2.3.2.1&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.1.2.3 php-src/ext/standard/tests/file/filetype_variation.phpt:1.1.2.3.2.1 --- php-src/ext/standard/tests/file/filetype_variation.phpt:1.1.2.3 Tue Jun 5 11:35:04 2007 +++ php-src/ext/standard/tests/file/filetype_variation.phpt Fri Nov 2 03:14:10 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 */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php