pajoye Wed, 27 Jan 2010 09:47:17 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=294077
Log: - fix and update test according to recent fixes Changed paths: U php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation13-win32.phpt U php/php-src/trunk/ext/standard/tests/file/rename_variation13-win32.phpt
Modified: php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation13-win32.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation13-win32.phpt 2010-01-27 08:14:50 UTC (rev 294076) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation13-win32.phpt 2010-01-27 09:47:17 UTC (rev 294077) @@ -14,23 +14,14 @@ * Source code: ext/standard/file.c * Alias to functions: */ - - -echo "*** Testing rename() with obscure files ***\n"; -$file_path = dirname(__FILE__)."/renameVar13"; -$aFile = $file_path.'/afile.tmp'; - -mkdir($file_path); - /* An array of files */ $names_arr = array( /* Invalid args */ - -1, - TRUE, + -1, /* -1 is just a valid filename on windows */ + TRUE, /* 1 as well, (string)TRUE > "1" */ FALSE, NULL, - // I think both p8 and php are wrong on the messages here - "", + "", // I think both p8 and php are wrong on the messages here //p8 generates different messages to php, php is probably wrong //php has either "File Exists" or "Permission Denied". " ", @@ -45,14 +36,24 @@ ); -for( $i=0; $i<count($names_arr); $i++ ) { +echo "*** Testing rename() with obscure files ***\n"; +$file_path = dirname(__FILE__)."/renameVar13"; +$aFile = $file_path.'/afile.tmp'; + +if (!mkdir($file_path)) { + die("fail to create $file_path tmp dir"); +} + +for( $i=0; $i < count($names_arr); $i++ ) { $name = $names_arr[$i]; - echo "-- testing '$name' --\n"; + echo "-- $i testing '$name' " . gettype($name) . " --\n"; + touch($aFile); var_dump(rename($aFile, $name)); if (file_exists($name)) { unlink($name); } + if (file_exists($aFile)) { unlink($aFile); } @@ -67,52 +68,52 @@ ?> --EXPECTF-- *** Testing rename() with obscure files *** --- testing '-1' -- +-- 0 testing '-1' integer -- bool(true) -Warning: rename(-1,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename(-1,%s/renameVar13/afile.tmp): The system cannot find the file specified. (code: 2) in %s on line %d bool(false) --- testing '1' -- +-- 1 testing '1' boolean -- bool(true) -Warning: rename(1,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename(1,%s/renameVar13/afile.tmp): The system cannot find the file specified. (code: 2) in %s on line %d bool(false) --- testing '' -- +-- 2 testing '' boolean -- -Warning: rename(%s/renameVar13/afile.tmp,): No such file or directory in %s on line %d +Warning: rename(%s/renameVar13/afile.tmp,): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) -Warning: rename(,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename(,%s/renameVar13/afile.tmp): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) --- testing '' -- +-- 3 testing '' NULL -- -Warning: rename(%s/renameVar13/afile.tmp,): No such file or directory in %s on line %d +Warning: rename(%s/renameVar13/afile.tmp,): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) -Warning: rename(,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename(,%s/renameVar13/afile.tmp): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) --- testing '' -- +-- 4 testing '' string -- -Warning: rename(%s/renameVar13/afile.tmp,): No such file or directory in %s on line %d +Warning: rename(%s/renameVar13/afile.tmp,): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) -Warning: rename(,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename(,%s/renameVar13/afile.tmp): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) --- testing ' ' -- +-- 5 testing ' ' string -- -Warning: rename(%s/renameVar13/afile.tmp, ): No such file or directory in %s on line %d +Warning: rename(%s/renameVar13/afile.tmp, ): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) -Warning: rename( ,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename( ,%s/renameVar13/afile.tmp): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) --- testing ' ' -- +-- 6 testing ' ' string -- -Warning: rename(%s/renameVar13/afile.tmp,): No such file or directory in %s on line %d +Warning: rename(%s/renameVar13/afile.tmp,): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) -Warning: rename(,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename(,%s/renameVar13/afile.tmp): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) --- testing 'Array' -- +-- 7 testing 'Array' array -- Warning: rename() expects parameter 2 to be string, array given in %s on line %d bool(false) @@ -121,19 +122,19 @@ Warning: rename() expects parameter 1 to be string, array given in %s on line %d bool(false) --- testing '/no/such/file/dir' -- +-- 8 testing '/no/such/file/dir' string -- -Warning: rename(%s/renameVar13/afile.tmp,/no/such/file/dir): No such file or directory in %s on line %d +Warning: rename(%s/renameVar13/afile.tmp,/no/such/file/dir): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) -Warning: rename(/no/such/file/dir,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename(/no/such/file/dir,%s/renameVar13/afile.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) --- testing 'php/php' -- +-- 9 testing 'php/php' string -- -Warning: rename(%s/renameVar13/afile.tmp,php/php): No such file or directory in %s on line %d +Warning: rename(%s/renameVar13/afile.tmp,php/php): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) -Warning: rename(php/php,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename(php/php,%s/renameVar13/afile.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) *** Done *** Modified: php/php-src/trunk/ext/standard/tests/file/rename_variation13-win32.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/file/rename_variation13-win32.phpt 2010-01-27 08:14:50 UTC (rev 294076) +++ php/php-src/trunk/ext/standard/tests/file/rename_variation13-win32.phpt 2010-01-27 09:47:17 UTC (rev 294077) @@ -14,23 +14,14 @@ * Source code: ext/standard/file.c * Alias to functions: */ - - -echo "*** Testing rename() with obscure files ***\n"; -$file_path = dirname(__FILE__)."/renameVar13"; -$aFile = $file_path.'/afile.tmp'; - -mkdir($file_path); - /* An array of files */ $names_arr = array( /* Invalid args */ - -1, - TRUE, + -1, /* -1 is just a valid filename on windows */ + TRUE, /* 1 as well, (string)TRUE > "1" */ FALSE, NULL, - // I think both p8 and php are wrong on the messages here - "", + "", // I think both p8 and php are wrong on the messages here //p8 generates different messages to php, php is probably wrong //php has either "File Exists" or "Permission Denied". " ", @@ -45,14 +36,24 @@ ); -for( $i=0; $i<count($names_arr); $i++ ) { +echo "*** Testing rename() with obscure files ***\n"; +$file_path = dirname(__FILE__)."/renameVar13"; +$aFile = $file_path.'/afile.tmp'; + +if (!mkdir($file_path)) { + die("fail to create $file_path tmp dir"); +} + +for( $i=0; $i < count($names_arr); $i++ ) { $name = $names_arr[$i]; - echo "-- testing '$name' --\n"; + echo "-- $i testing '$name' " . gettype($name) . " --\n"; + touch($aFile); var_dump(rename($aFile, $name)); if (file_exists($name)) { unlink($name); } + if (file_exists($aFile)) { unlink($aFile); } @@ -67,75 +68,72 @@ ?> --EXPECTF-- *** Testing rename() with obscure files *** --- testing '-1' -- +-- 0 testing '-1' integer -- bool(true) -Warning: rename(-1,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename(-1,%s/renameVar13/afile.tmp): The system cannot find the file specified. (code: 2) in %s on line %d bool(false) --- testing '1' -- +-- 1 testing '1' boolean -- bool(true) -Warning: rename(1,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename(1,%s/renameVar13/afile.tmp): The system cannot find the file specified. (code: 2) in %s on line %d bool(false) --- testing '' -- +-- 2 testing '' boolean -- -Warning: rename(%s/renameVar13/afile.tmp,): No such file or directory in %s on line %d +Warning: rename(%s/renameVar13/afile.tmp,): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) -Warning: rename(,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename(,%s/renameVar13/afile.tmp): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) --- testing '' -- +-- 3 testing '' NULL -- -Warning: rename(%s/renameVar13/afile.tmp,): No such file or directory in %s on line %d +Warning: rename(%s/renameVar13/afile.tmp,): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) -Warning: rename(,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename(,%s/renameVar13/afile.tmp): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) --- testing '' -- +-- 4 testing '' string -- -Warning: rename(%s/renameVar13/afile.tmp,): No such file or directory in %s on line %d +Warning: rename(%s/renameVar13/afile.tmp,): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) -Warning: rename(,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename(,%s/renameVar13/afile.tmp): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) --- testing ' ' -- +-- 5 testing ' ' string -- -Warning: rename(%s/renameVar13/afile.tmp, ): No such file or directory in %s on line %d +Warning: rename(%s/renameVar13/afile.tmp, ): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) -Warning: rename( ,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename( ,%s/renameVar13/afile.tmp): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) --- testing ' ' -- +-- 6 testing ' +Warning: rename(%s/renameVar13/afile.tmp,): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d +bool(false) -Warning: rename(%s/renameVar13/afile.tmp,): No such file or directory in %s on line %d +Warning: rename(,%s/renameVar13/afile.tmp): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d bool(false) +-- 7 testing 'Array' array -- -Warning: rename(,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename() expects parameter 2 to be string, array given in %s on line %d bool(false) -Notice: Array to string conversion in %s on line %d --- testing 'Array' -- +Warning: file_exists() expects parameter 1 to be string, array given in %s on line %d Notice: Array to string conversion in %s on line %d -bool(true) +bool(false) +-- 8 testing '/no/such/file/dir' string -- -Warning: file_exists() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d - -Notice: Array to string conversion in %s on line %d -bool(true) --- testing '/no/such/file/dir' -- - -Warning: rename(%s/renameVar13/afile.tmp,/no/such/file/dir): No such file or directory in %s on line %d +Warning: rename(%s/renameVar13/afile.tmp,/no/such/file/dir): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) -Warning: rename(/no/such/file/dir,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename(/no/such/file/dir,%s/renameVar13/afile.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) --- testing 'php/php' -- +-- 9 testing 'php/php' string -- -Warning: rename(%s/renameVar13/afile.tmp,php/php): No such file or directory in %s on line %d +Warning: rename(%s/renameVar13/afile.tmp,php/php): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) -Warning: rename(php/php,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +Warning: rename(php/php,%s/renameVar13/afile.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) *** Done ***
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php