1--TEST-- 2Test rename() function: usage variations 3--SKIPIF-- 4<?php 5if (substr(PHP_OS, 0, 3) != 'WIN') { 6 die('skip.. only for Windows'); 7} 8?> 9--FILE-- 10<?php 11require __DIR__.'/file.inc'; 12 13$file_path = __DIR__; 14mkdir("$file_path/rename_variation2-win32_dir"); 15 16/* Renaming a file and directory to numeric name */ 17echo "\n*** Testing rename() by renaming a file and directory to numeric name ***\n"; 18$fp = fopen($file_path."/rename_variation2-win32.tmp", "w"); 19fclose($fp); 20 21// renaming existing file to numeric name 22var_dump( rename($file_path."/rename_variation2-win32.tmp", $file_path."/12346") ); 23 24// ensure that rename worked fine 25var_dump( file_exists($file_path."/rename_variation2-win32.tmp" ) ); // expecting false 26var_dump( file_exists($file_path."/12346" ) ); // expecting true 27 28unlink($file_path."/12346"); 29 30// renaming a directory to numeric name 31var_dump( rename($file_path."/rename_variation2-win32_dir/", $file_path."/12346") ); 32 33// ensure that rename worked fine 34var_dump( file_exists($file_path."/rename_variation2-win32_dir" ) ); // expecting false 35var_dump( file_exists($file_path."/12346" ) ); // expecting true 36 37echo "Done\n"; 38?> 39--CLEAN-- 40<?php 41$file_path = __DIR__; 42rmdir($file_path."/12346"); 43?> 44--EXPECT-- 45*** Testing rename() by renaming a file and directory to numeric name *** 46bool(true) 47bool(false) 48bool(true) 49bool(true) 50bool(false) 51bool(true) 52Done 53