import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-file / rename_variation1-win32.php
blob31c347c3db71868aa6d65b9988cec727ac92aef5
1 <?php
2 /* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
3 Description: Renames a file or directory
4 */
6 require dirname(__FILE__).'/file.inc';
8 /* creating directory */
9 $file_path = dirname(__FILE__);
11 // rename dirs across directories
12 echo "\n*** Testing rename() : renaming directory across directories ***\n";
13 $src_dirs = array (
14 /* Testing simple directory tree */
15 "$file_path/rename_variation/",
17 /* Testing a dir with trailing slash */
18 "$file_path/rename_variation/",
20 /* Testing dir with double trailing slashes */
21 "$file_path//rename_variation//",
24 $dest_dir = "$file_path/rename_variation_dir";
26 // create the $dest_dir
27 mkdir($dest_dir);
29 $counter = 1;
31 /* loop through each $src_dirs and rename it to $dest_dir */
32 foreach($src_dirs as $src_dir) {
33 echo "-- Iteration $counter --\n";
35 // create the src dir
36 mkdir("$file_path/rename_variation/");
37 // rename the src dir to a new dir in dest dir
38 var_dump( rename($src_dir, $dest_dir."/new_dir") );
39 // ensure that dir was renamed
40 var_dump( file_exists($src_dir) ); // expecting false
41 var_dump( file_exists($dest_dir."/new_dir") ); // expecting true
43 // remove the new dir
44 rmdir($dest_dir."/new_dir");
45 $counter++;
48 echo "Done\n";
49 ?><?php
50 $file_path = dirname(__FILE__);
51 unlink($file_path."/rename_variation_link.tmp");
52 unlink($file_path."/rename_variation.tmp");
53 rmdir($file_path."/rename_variation_dir");