Annotation of embedaddon/php/ext/standard/tests/file/rename_variation4.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test rename() function: usage variations-5
3: --SKIPIF--
4: <?php
5: if (substr(PHP_OS, 0, 3) == 'WIN') {
6: die('skip.. only for Linux');
7: }
8: ?>
9: --FILE--
10: <?php
11:
12: $file_path = dirname(__FILE__);
13:
14: require dirname(__FILE__).'/file.inc';
15:
16: /* Renaming a file, link and directory to numeric name */
17: echo "\n*** Testing rename() by renaming a file, link and directory to numeric name ***\n";
18: $fp = fopen($file_path."/rename_variation.tmp", "w");
19: fclose($fp);
20: // renaming existing file to numeric name
21: var_dump( rename($file_path."/rename_variation.tmp", $file_path."/12345") );
22: // ensure that rename worked fine
23: var_dump( file_exists($file_path."/rename_variation.tmp" ) ); // expecting false
24: var_dump( file_exists($file_path."/12345" ) ); // expecting true
25: // remove the file
26: unlink($file_path."/12345");
27:
28: mkdir($file_path."/rename_variation_dir");
29:
30: // renaming a directory to numeric name
31: var_dump( rename($file_path."/rename_variation_dir/", $file_path."/12345") );
32: // ensure that rename worked fine
33: var_dump( file_exists($file_path."/rename_variation_dir" ) ); // expecting false
34: var_dump( file_exists($file_path."/12345" ) ); // expecting true
35:
36: echo "Done\n";
37: ?>
38: --CLEAN--
39: <?php
40: $file_path = dirname(__FILE__);
41: rmdir($file_path."/12345");
42: ?>
43: --EXPECTF--
44: *** Testing rename() by renaming a file, link and directory to numeric name ***
45: bool(true)
46: bool(false)
47: bool(true)
48: bool(true)
49: bool(false)
50: bool(true)
51: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>