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 = dirname(__FILE__);
13
14require dirname(__FILE__).'/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_variation.tmp", "w");
19fclose($fp);
20// renaming existing file to numeric name
21var_dump( rename($file_path."/rename_variation.tmp", $file_path."/12345") );
22// ensure that rename worked fine
23var_dump( file_exists($file_path."/rename_variation.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_variation_dir");
29
30// renaming a directory to numeric name
31var_dump( rename($file_path."/rename_variation_dir/", $file_path."/12345") );
32// ensure that rename worked fine
33var_dump( file_exists($file_path."/rename_variation_dir" ) );  // expecting false
34var_dump( file_exists($file_path."/12345" ) );  // expecting true
35
36echo "Done\n";
37?>
38--CLEAN--
39<?php
40$file_path = dirname(__FILE__);
41rmdir($file_path."/12345");
42?>
43--EXPECTF--
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