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