Annotation of embedaddon/php/ext/standard/tests/file/rename_variation2-win32.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test rename() function: usage variations
                      3: --SKIPIF--
                      4: <?php
                      5: if (substr(PHP_OS, 0, 3) != 'WIN') {
                      6:     die('skip.. only for Windows');
                      7: }
                      8: ?>
                      9: --FILE--
                     10: <?php
                     11: /* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
                     12:    Description: Renames a file or directory
                     13: */
                     14: 
                     15: require dirname(__FILE__).'/file.inc';
                     16: 
                     17: $file_path = dirname(__FILE__);
                     18: mkdir("$file_path/rename_variation_dir");
                     19: 
                     20: /* Renaming a file and directory to numeric name */
                     21: echo "\n*** Testing rename() by renaming a file and directory to numeric name ***\n";
                     22: $fp = fopen($file_path."/rename_variation.tmp", "w");
                     23: fclose($fp);
                     24: 
                     25: // renaming existing file to numeric name
                     26: var_dump( rename($file_path."/rename_variation.tmp", $file_path."/12345") );
                     27: 
                     28: // ensure that rename worked fine
                     29: var_dump( file_exists($file_path."/rename_variation.tmp" ) );  // expecting false
                     30: var_dump( file_exists($file_path."/12345" ) );  // expecting true
                     31: 
                     32: unlink($file_path."/12345");
                     33: 
                     34: // renaming a directory to numeric name
                     35: var_dump( rename($file_path."/rename_variation_dir/", $file_path."/12345") );
                     36: 
                     37: // ensure that rename worked fine
                     38: var_dump( file_exists($file_path."/rename_variation_dir" ) );  // expecting false
                     39: var_dump( file_exists($file_path."/12345" ) );  // expecting true
                     40: 
                     41: rmdir($file_path."/12345");
                     42: 
                     43: echo "Done\n";
                     44: ?>
                     45: --CLEAN--
                     46: <?php
                     47: $file_path = dirname(__FILE__);
                     48: unlink($file_path."/rename_variation_link.tmp");
                     49: unlink($file_path."/rename_variation.tmp");
                     50: rmdir($file_path."/rename_variation_dir");
                     51: ?>
                     52: --EXPECTF--
                     53: *** Testing rename() by renaming a file and directory to numeric name ***
                     54: bool(true)
                     55: bool(false)
                     56: bool(true)
                     57: bool(true)
                     58: bool(false)
                     59: bool(true)
                     60: Done
                     61: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>