pajoye Wed, 27 Jan 2010 11:23:43 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=294081
Log: - update/fix/skip/add for rename tests Changed paths: U php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation11-win32.phpt A php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation12-win32.phpt U php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation12.phpt U php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation13.phpt U php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation3-win32.phpt U php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation6-win32.phpt A php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation8-win32.phpt U php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation8.phpt U php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation9.phpt U php/php-src/trunk/ext/standard/tests/file/rename_variation11-win32.phpt A php/php-src/trunk/ext/standard/tests/file/rename_variation12-win32.phpt U php/php-src/trunk/ext/standard/tests/file/rename_variation12.phpt U php/php-src/trunk/ext/standard/tests/file/rename_variation13.phpt U php/php-src/trunk/ext/standard/tests/file/rename_variation3-win32.phpt U php/php-src/trunk/ext/standard/tests/file/rename_variation6-win32.phpt A php/php-src/trunk/ext/standard/tests/file/rename_variation8-win32.phpt U php/php-src/trunk/ext/standard/tests/file/rename_variation8.phpt U php/php-src/trunk/ext/standard/tests/file/rename_variation9.phpt
Modified: php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation11-win32.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation11-win32.phpt 2010-01-27 10:39:23 UTC (rev 294080) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation11-win32.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -92,12 +92,12 @@ -- Iteration 5 -- -Warning: rename(%s\renameVar11\renameVar11Sub\..\\\renameVar11Sub\\..\\..\renameVar11Sub\renameMe.tmp,%s\renameVar11\renameVar11Sub\..\\\renameVar11Sub\\..\\..\renameVar11Sub\IwasRenamed.tmp): No such file or directory in %s on line %d +Warning: rename(%s\renameVar11\renameVar11Sub\..\\\renameVar11Sub\\..\\..\renameVar11Sub\renameMe.tmp,%s\renameVar11\renameVar11Sub\..\\\renameVar11Sub\\..\\..\renameVar11Sub\IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) -- Iteration 6 -- -Warning: rename(%s\renameVar11\renameVar11Sub\BADDIR\renameMe.tmp,%s\renameVar11\renameVar11Sub\BADDIR\IwasRenamed.tmp): No such file or directory in %s on line %d +Warning: rename(%s\renameVar11\renameVar11Sub\BADDIR\renameMe.tmp,%s\renameVar11\renameVar11Sub\BADDIR\IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) -- Iteration 7 -- @@ -118,7 +118,7 @@ -- Iteration 11 -- -Warning: rename(BADDIR\renameMe.tmp,BADDIR\IwasRenamed.tmp): No such file or directory in %s on line %d +Warning: rename(BADDIR\renameMe.tmp,BADDIR\IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) -- Iteration 12 -- Added: php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation12-win32.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation12-win32.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation12-win32.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -0,0 +1,121 @@ +--TEST-- +Test rename() function : variation - various relative, absolute paths +--CREDITS-- +Dave Kelsey <d_kel...@uk.ibm.com> +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows'); +?> +--FILE-- +<?php +/* Prototype : bool rename(string old_name, string new_name[, resource context]) + * Description: Rename a file + * Source code: ext/standard/file.c + * Alias to functions: + */ + +/* Creating unique files in various dirs by passing relative paths to $dir arg */ + +echo "*** Testing rename() with absolute and relative paths ***\n"; +$mainDir = "renameVar11"; +$subDir = "renameVar11Sub"; +$absMainDir = dirname(__FILE__)."/".$mainDir; +mkdir($absMainDir); +$absSubDir = $absMainDir."/".$subDir; +mkdir($absSubDir); + +$fromFile = "renameMe.tmp"; +$toFile = "IwasRenamed.tmp"; + +$old_dir_path = getcwd(); +chdir(dirname(__FILE__)); + +$allDirs = array( + // absolute paths + "$absSubDir/", + "$absSubDir/../".$subDir, + "$absSubDir//.././".$subDir, + "$absSubDir/../../".$mainDir."/./".$subDir, + "$absSubDir/..///".$subDir."//..//../".$subDir, + "$absSubDir/BADDIR", + + + // relative paths + $mainDir."/".$subDir, + $mainDir."//".$subDir, + $mainDir."///".$subDir, + "./".$mainDir."/../".$mainDir."/".$subDir, + "BADDIR", +); + +for($i = 0; $i<count($allDirs); $i++) { + $j = $i+1; + $dir = $allDirs[$i]; + echo "\n-- Iteration $j --\n"; + touch($absSubDir."/".$fromFile); + $res = rename($dir."/".$fromFile, $dir."/".$toFile); + var_dump($res); + if ($res == true) { + $res = rename($dir."/".$toFile, $dir."/".$fromFile); + var_dump($res); + } + unlink($absSubDir."/".$fromFile); +} + +chdir($old_dir_path); +rmdir($absSubDir); +rmdir($absMainDir); + +echo "\n*** Done ***\n"; +?> +--EXPECTF-- +*** Testing rename() with absolute and relative paths *** + +-- Iteration 1 -- +bool(true) +bool(true) + +-- Iteration 2 -- +bool(true) +bool(true) + +-- Iteration 3 -- +bool(true) +bool(true) + +-- Iteration 4 -- +bool(true) +bool(true) + +-- Iteration 5 -- + +Warning: rename(%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/renameMe.tmp,%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: rename(%s/renameVar11/renameVar11Sub/BADDIR/renameMe.tmp,%s/renameVar11/renameVar11Sub/BADDIR/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d +bool(false) + +-- Iteration 7 -- +bool(true) +bool(true) + +-- Iteration 8 -- +bool(true) +bool(true) + +-- Iteration 9 -- +bool(true) +bool(true) + +-- Iteration 10 -- +bool(true) +bool(true) + +-- Iteration 11 -- + +Warning: rename(BADDIR/renameMe.tmp,BADDIR/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d +bool(false) + +*** Done *** \ No newline at end of file Modified: php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation12.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation12.phpt 2010-01-27 10:39:23 UTC (rev 294080) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation12.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -2,6 +2,10 @@ Test rename() function : variation - various relative, absolute paths --CREDITS-- Dave Kelsey <d_kel...@uk.ibm.com> +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') die('skip.. not for Windows'); +?> --FILE-- <?php /* Prototype : bool rename(string old_name, string new_name[, resource context]) @@ -85,12 +89,12 @@ -- Iteration 5 -- -Warning: rename(%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/renameMe.tmp,%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/IwasRenamed.tmp): No such file or directory in %s on line %d +Warning: rename(%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/renameMe.tmp,%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) -- Iteration 6 -- -Warning: rename(%s/renameVar11/renameVar11Sub/BADDIR/renameMe.tmp,%s/renameVar11/renameVar11Sub/BADDIR/IwasRenamed.tmp): No such file or directory in %s on line %d +Warning: rename(%s/renameVar11/renameVar11Sub/BADDIR/renameMe.tmp,%s/renameVar11/renameVar11Sub/BADDIR/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) -- Iteration 7 -- @@ -111,7 +115,7 @@ -- Iteration 11 -- -Warning: rename(BADDIR/renameMe.tmp,BADDIR/IwasRenamed.tmp): No such file or directory in %s on line %d +Warning: rename(BADDIR/renameMe.tmp,BADDIR/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) *** Done *** \ No newline at end of file Modified: php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation13.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation13.phpt 2010-01-27 10:39:23 UTC (rev 294080) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation13.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -5,7 +5,7 @@ --SKIPIF-- <?php if(substr(PHP_OS, 0, 3) == "WIN") - die("skip Not for Windows"); + die("skip. Not for Windows"); ?> --FILE-- <?php @@ -15,7 +15,6 @@ * Alias to functions: */ - echo "*** Testing rename() with obscure files ***\n"; $file_path = dirname(__FILE__)."/renameVar13"; $aFile = $file_path.'/afile.tmp'; @@ -129,4 +128,4 @@ Warning: rename(php/php,%s/renameVar13/afile.tmp): %s directory in %s on line %d bool(false) -*** Done *** \ No newline at end of file +*** Done *** Modified: php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation3-win32.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation3-win32.phpt 2010-01-27 10:39:23 UTC (rev 294080) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation3-win32.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -68,7 +68,7 @@ -- Renaming existing file to existing directory name -- -Warning: rename(%s/rename_variation3.tmp,%s/rename_variation3_dir): No such file or directory in %s on line %d +Warning: rename(%s/rename_variation3.tmp,%s/rename_variation3_dir): Access is denied. (code: 5) in %s on line %d bool(false) bool(true) bool(true) Modified: php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation6-win32.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation6-win32.phpt 2010-01-27 10:39:23 UTC (rev 294080) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation6-win32.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -4,6 +4,10 @@ <?php if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows'); if (!function_exists("symlink")) die("skip symlinks are not supported"); +$ret = exec('mklink rename_variation13tmp.lnk ' . __FILE__ .' 2>&1', $out); +if (strpos($ret, 'privilege')) { + die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.'); +} ?> --FILE-- <?php Added: php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation8-win32.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation8-win32.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation8-win32.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -0,0 +1,70 @@ +--TEST-- +Test rename() function: variation +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows'); +?> +--FILE-- +<?php +/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] ); + Description: Renames a file or directory +*/ + +echo "\n*** Testing rename() on non-existing file ***\n"; +$file_path = dirname(__FILE__); + +// try renaming a non existing file +$src_name = $file_path."/non_existent_file.tmp"; +$dest_name = $file_path."/rename_variation8_new.tmp"; +var_dump( rename($src_name, $dest_name) ); + +// ensure that $dest_name didn't get created +var_dump( file_exists($src_name) ); // expecting false +var_dump( file_exists($dest_name) ); // expecting false + +// rename a existing dir to new name +echo "\n*** Testing rename() on existing directory ***\n"; +$dir_name = $file_path."/rename_basic_dir"; +mkdir($dir_name); +$new_dir_name = $file_path."/rename_basic_dir1"; +var_dump( rename($dir_name, $new_dir_name) ); +//ensure that $new_dir_name got created +var_dump( file_exists($dir_name) ); // expecting false +var_dump( file_exists($new_dir_name) ); // expecting true + +// try to rename an non_existing dir +echo "\n*** Testing rename() on non-existing directory ***\n"; +$non_existent_dir_name = $file_path."/non_existent_dir"; +$new_dir_name = "$file_path/rename_basic_dir2"; +var_dump( rename($non_existent_dir_name, $new_dir_name) ); +// ensure that $new_dir_name didn't get created +var_dump( file_exists($non_existent_dir_name) ); // expecting flase +var_dump( file_exists($new_dir_name) ); // expecting false + +echo "Done\n"; +?> +--CLEAN-- +<?php +rmdir(dirname(__FILE__)."/rename_basic_dir1"); +?> +--EXPECTF-- +*** Testing rename() on non-existing file *** + +Warning: rename(%s/non_existent_file.tmp,%s/rename_variation8_new.tmp): The system cannot find the file specified. (code: 2) in %s on line %d +bool(false) +bool(false) +bool(false) + +*** Testing rename() on existing directory *** +bool(true) +bool(false) +bool(true) + +*** Testing rename() on non-existing directory *** + +Warning: rename(%s/non_existent_dir,%s/rename_basic_dir2): The system cannot find the file specified. (code: 2) in %s on line %d +bool(false) +bool(false) +bool(false) +Done + Modified: php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation8.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation8.phpt 2010-01-27 10:39:23 UTC (rev 294080) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation8.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -1,5 +1,9 @@ --TEST-- Test rename() function: variation +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') die('skip.. not for Windows'); +?> --FILE-- <?php /* Prototype: bool rename ( string $oldname, string $newname [, resource $context] ); @@ -41,6 +45,7 @@ ?> --CLEAN-- <?php +unlink(dirname(__FILE__)."/rename_basic_new2.tmp"); rmdir(dirname(__FILE__)."/rename_basic_dir1"); ?> --EXPECTF-- Modified: php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation9.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation9.phpt 2010-01-27 10:39:23 UTC (rev 294080) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/file/rename_variation9.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -41,7 +41,7 @@ unlink(dirname(__FILE__)."/rename_variation9_new.tmp"); rmdir(dirname(__FILE__)."/rename_variation_dir9_new"); ?> ---EXPECTF-- +--EXPECT-- *** Testing rename() by giving stream context as third argument *** bool(true) bool(false) Modified: php/php-src/trunk/ext/standard/tests/file/rename_variation11-win32.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/file/rename_variation11-win32.phpt 2010-01-27 10:39:23 UTC (rev 294080) +++ php/php-src/trunk/ext/standard/tests/file/rename_variation11-win32.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -92,12 +92,12 @@ -- Iteration 5 -- -Warning: rename(%s\renameVar11\renameVar11Sub\..\\\renameVar11Sub\\..\\..\renameVar11Sub\renameMe.tmp,%s\renameVar11\renameVar11Sub\..\\\renameVar11Sub\\..\\..\renameVar11Sub\IwasRenamed.tmp): No such file or directory in %s on line %d +Warning: rename(%s\renameVar11\renameVar11Sub\..\\\renameVar11Sub\\..\\..\renameVar11Sub\renameMe.tmp,%s\renameVar11\renameVar11Sub\..\\\renameVar11Sub\\..\\..\renameVar11Sub\IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) -- Iteration 6 -- -Warning: rename(%s\renameVar11\renameVar11Sub\BADDIR\renameMe.tmp,%s\renameVar11\renameVar11Sub\BADDIR\IwasRenamed.tmp): No such file or directory in %s on line %d +Warning: rename(%s\renameVar11\renameVar11Sub\BADDIR\renameMe.tmp,%s\renameVar11\renameVar11Sub\BADDIR\IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) -- Iteration 7 -- @@ -118,7 +118,7 @@ -- Iteration 11 -- -Warning: rename(BADDIR\renameMe.tmp,BADDIR\IwasRenamed.tmp): No such file or directory in %s on line %d +Warning: rename(BADDIR\renameMe.tmp,BADDIR\IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) -- Iteration 12 -- Added: php/php-src/trunk/ext/standard/tests/file/rename_variation12-win32.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/file/rename_variation12-win32.phpt (rev 0) +++ php/php-src/trunk/ext/standard/tests/file/rename_variation12-win32.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -0,0 +1,121 @@ +--TEST-- +Test rename() function : variation - various relative, absolute paths +--CREDITS-- +Dave Kelsey <d_kel...@uk.ibm.com> +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows'); +?> +--FILE-- +<?php +/* Prototype : bool rename(string old_name, string new_name[, resource context]) + * Description: Rename a file + * Source code: ext/standard/file.c + * Alias to functions: + */ + +/* Creating unique files in various dirs by passing relative paths to $dir arg */ + +echo "*** Testing rename() with absolute and relative paths ***\n"; +$mainDir = "renameVar11"; +$subDir = "renameVar11Sub"; +$absMainDir = dirname(__FILE__)."/".$mainDir; +mkdir($absMainDir); +$absSubDir = $absMainDir."/".$subDir; +mkdir($absSubDir); + +$fromFile = "renameMe.tmp"; +$toFile = "IwasRenamed.tmp"; + +$old_dir_path = getcwd(); +chdir(dirname(__FILE__)); + +$allDirs = array( + // absolute paths + "$absSubDir/", + "$absSubDir/../".$subDir, + "$absSubDir//.././".$subDir, + "$absSubDir/../../".$mainDir."/./".$subDir, + "$absSubDir/..///".$subDir."//..//../".$subDir, + "$absSubDir/BADDIR", + + + // relative paths + $mainDir."/".$subDir, + $mainDir."//".$subDir, + $mainDir."///".$subDir, + "./".$mainDir."/../".$mainDir."/".$subDir, + "BADDIR", +); + +for($i = 0; $i<count($allDirs); $i++) { + $j = $i+1; + $dir = $allDirs[$i]; + echo "\n-- Iteration $j --\n"; + touch($absSubDir."/".$fromFile); + $res = rename($dir."/".$fromFile, $dir."/".$toFile); + var_dump($res); + if ($res == true) { + $res = rename($dir."/".$toFile, $dir."/".$fromFile); + var_dump($res); + } + unlink($absSubDir."/".$fromFile); +} + +chdir($old_dir_path); +rmdir($absSubDir); +rmdir($absMainDir); + +echo "\n*** Done ***\n"; +?> +--EXPECTF-- +*** Testing rename() with absolute and relative paths *** + +-- Iteration 1 -- +bool(true) +bool(true) + +-- Iteration 2 -- +bool(true) +bool(true) + +-- Iteration 3 -- +bool(true) +bool(true) + +-- Iteration 4 -- +bool(true) +bool(true) + +-- Iteration 5 -- + +Warning: rename(%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/renameMe.tmp,%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: rename(%s/renameVar11/renameVar11Sub/BADDIR/renameMe.tmp,%s/renameVar11/renameVar11Sub/BADDIR/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d +bool(false) + +-- Iteration 7 -- +bool(true) +bool(true) + +-- Iteration 8 -- +bool(true) +bool(true) + +-- Iteration 9 -- +bool(true) +bool(true) + +-- Iteration 10 -- +bool(true) +bool(true) + +-- Iteration 11 -- + +Warning: rename(BADDIR/renameMe.tmp,BADDIR/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d +bool(false) + +*** Done *** \ No newline at end of file Modified: php/php-src/trunk/ext/standard/tests/file/rename_variation12.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/file/rename_variation12.phpt 2010-01-27 10:39:23 UTC (rev 294080) +++ php/php-src/trunk/ext/standard/tests/file/rename_variation12.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -2,6 +2,10 @@ Test rename() function : variation - various relative, absolute paths --CREDITS-- Dave Kelsey <d_kel...@uk.ibm.com> +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') die('skip.. not for Windows'); +?> --FILE-- <?php /* Prototype : bool rename(string old_name, string new_name[, resource context]) @@ -85,12 +89,12 @@ -- Iteration 5 -- -Warning: rename(%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/renameMe.tmp,%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/IwasRenamed.tmp): No such file or directory in %s on line %d +Warning: rename(%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/renameMe.tmp,%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) -- Iteration 6 -- -Warning: rename(%s/renameVar11/renameVar11Sub/BADDIR/renameMe.tmp,%s/renameVar11/renameVar11Sub/BADDIR/IwasRenamed.tmp): No such file or directory in %s on line %d +Warning: rename(%s/renameVar11/renameVar11Sub/BADDIR/renameMe.tmp,%s/renameVar11/renameVar11Sub/BADDIR/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) -- Iteration 7 -- @@ -111,7 +115,7 @@ -- Iteration 11 -- -Warning: rename(BADDIR/renameMe.tmp,BADDIR/IwasRenamed.tmp): No such file or directory in %s on line %d +Warning: rename(BADDIR/renameMe.tmp,BADDIR/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) *** Done *** \ No newline at end of file Modified: php/php-src/trunk/ext/standard/tests/file/rename_variation13.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/file/rename_variation13.phpt 2010-01-27 10:39:23 UTC (rev 294080) +++ php/php-src/trunk/ext/standard/tests/file/rename_variation13.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -5,7 +5,7 @@ --SKIPIF-- <?php if(substr(PHP_OS, 0, 3) == "WIN") - die("skip Not for Windows"); + die("skip. Not for Windows"); ?> --FILE-- <?php @@ -15,7 +15,6 @@ * Alias to functions: */ - echo "*** Testing rename() with obscure files ***\n"; $file_path = dirname(__FILE__)."/renameVar13"; $aFile = $file_path.'/afile.tmp'; @@ -98,8 +97,7 @@ Warning: rename( ,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d bool(false) --- testing ' ' -- - +-- testing ' Warning: rename(%s/renameVar13/afile.tmp,): No such file or directory in %s on line %d bool(false) Modified: php/php-src/trunk/ext/standard/tests/file/rename_variation3-win32.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/file/rename_variation3-win32.phpt 2010-01-27 10:39:23 UTC (rev 294080) +++ php/php-src/trunk/ext/standard/tests/file/rename_variation3-win32.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -16,52 +16,66 @@ /* creating directory */ $file_path = dirname(__FILE__); -$dirname = "$file_path/rename_variation_dir"; +$dirname = "$file_path/rename_variation3_dir"; mkdir($dirname); /* test rename() by trying to rename an existing file/dir to the same name and one another */ -$filename = "$file_path/rename_variation.tmp"; +$filename = "$file_path/rename_variation3.tmp"; $fp = fopen($filename, "w"); fclose($fp); echo "\n-- Renaming file to same file name --\n"; var_dump( rename($filename, $filename) ); +var_dump( file_exists($filename) ); echo "\n-- Renaming directory to same directory name --\n"; var_dump( rename($dirname, $dirname) ); +var_dump( file_exists($dirname) ); echo "\n-- Renaming existing file to existing directory name --\n"; var_dump( rename($filename, $dirname) ); +var_dump( file_exists($filename) ); +var_dump( file_exists($dirname) ); echo "\n-- Renaming existing directory to existing file name --\n"; $fp = fopen($filename, "w"); fclose($fp); + var_dump( rename($dirname, $filename) ); +var_dump( file_exists($filename) ); +var_dump( file_exists($dirname) ); echo "Done\n"; ?> --CLEAN-- <?php $file_path = dirname(__FILE__); -unlink($file_path."/rename_variation_link.tmp"); -unlink($file_path."/rename_variation.tmp"); -rmdir($file_path."/rename_variation_dir"); -rmdir($file_path."/rename_variation.tmp"); +unlink($file_path."/rename_variation3_link.tmp"); +unlink($file_path."/rename_variation3.tmp"); +rmdir($file_path."/rename_variation3_dir"); +rmdir($file_path."/rename_variation3.tmp"); ?> --EXPECTF-- -- Renaming file to same file name -- bool(true) +bool(true) -- Renaming directory to same directory name -- bool(true) +bool(true) -- Renaming existing file to existing directory name -- -Warning: rename(%s/rename_variation.tmp,%s/rename_variation_dir): No such file or directory in %s on line %d +Warning: rename(%s/rename_variation3.tmp,%s/rename_variation3_dir): Access is denied. (code: 5) in %s on line %d bool(false) +bool(true) +bool(true) -- Renaming existing directory to existing file name -- bool(true) +bool(true) +bool(false) Done + Modified: php/php-src/trunk/ext/standard/tests/file/rename_variation6-win32.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/file/rename_variation6-win32.phpt 2010-01-27 10:39:23 UTC (rev 294080) +++ php/php-src/trunk/ext/standard/tests/file/rename_variation6-win32.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -4,6 +4,10 @@ <?php if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows'); if (!function_exists("symlink")) die("skip symlinks are not supported"); +$ret = exec('mklink rename_variation13tmp.lnk ' . __FILE__ .' 2>&1', $out); +if (strpos($ret, 'privilege')) { + die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.'); +} ?> --FILE-- <?php Added: php/php-src/trunk/ext/standard/tests/file/rename_variation8-win32.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/file/rename_variation8-win32.phpt (rev 0) +++ php/php-src/trunk/ext/standard/tests/file/rename_variation8-win32.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -0,0 +1,70 @@ +--TEST-- +Test rename() function: variation +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows'); +?> +--FILE-- +<?php +/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] ); + Description: Renames a file or directory +*/ + +echo "\n*** Testing rename() on non-existing file ***\n"; +$file_path = dirname(__FILE__); + +// try renaming a non existing file +$src_name = $file_path."/non_existent_file.tmp"; +$dest_name = $file_path."/rename_variation8_new.tmp"; +var_dump( rename($src_name, $dest_name) ); + +// ensure that $dest_name didn't get created +var_dump( file_exists($src_name) ); // expecting false +var_dump( file_exists($dest_name) ); // expecting false + +// rename a existing dir to new name +echo "\n*** Testing rename() on existing directory ***\n"; +$dir_name = $file_path."/rename_basic_dir"; +mkdir($dir_name); +$new_dir_name = $file_path."/rename_basic_dir1"; +var_dump( rename($dir_name, $new_dir_name) ); +//ensure that $new_dir_name got created +var_dump( file_exists($dir_name) ); // expecting false +var_dump( file_exists($new_dir_name) ); // expecting true + +// try to rename an non_existing dir +echo "\n*** Testing rename() on non-existing directory ***\n"; +$non_existent_dir_name = $file_path."/non_existent_dir"; +$new_dir_name = "$file_path/rename_basic_dir2"; +var_dump( rename($non_existent_dir_name, $new_dir_name) ); +// ensure that $new_dir_name didn't get created +var_dump( file_exists($non_existent_dir_name) ); // expecting flase +var_dump( file_exists($new_dir_name) ); // expecting false + +echo "Done\n"; +?> +--CLEAN-- +<?php +rmdir(dirname(__FILE__)."/rename_basic_dir1"); +?> +--EXPECTF-- +*** Testing rename() on non-existing file *** + +Warning: rename(%s/non_existent_file.tmp,%s/rename_variation8_new.tmp): The system cannot find the file specified. (code: 2) in %s on line %d +bool(false) +bool(false) +bool(false) + +*** Testing rename() on existing directory *** +bool(true) +bool(false) +bool(true) + +*** Testing rename() on non-existing directory *** + +Warning: rename(%s/non_existent_dir,%s/rename_basic_dir2): The system cannot find the file specified. (code: 2) in %s on line %d +bool(false) +bool(false) +bool(false) +Done + Modified: php/php-src/trunk/ext/standard/tests/file/rename_variation8.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/file/rename_variation8.phpt 2010-01-27 10:39:23 UTC (rev 294080) +++ php/php-src/trunk/ext/standard/tests/file/rename_variation8.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -1,5 +1,9 @@ --TEST-- Test rename() function: variation +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') die('skip.. not for Windows'); +?> --FILE-- <?php /* Prototype: bool rename ( string $oldname, string $newname [, resource $context] ); @@ -64,3 +68,4 @@ bool(false) bool(false) Done + Modified: php/php-src/trunk/ext/standard/tests/file/rename_variation9.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/file/rename_variation9.phpt 2010-01-27 10:39:23 UTC (rev 294080) +++ php/php-src/trunk/ext/standard/tests/file/rename_variation9.phpt 2010-01-27 11:23:43 UTC (rev 294081) @@ -50,3 +50,4 @@ bool(false) bool(true) Done +
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php