import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-file / lstat_stat_variation3.php
blob945a668b7709d70e7ba47c6fb3f0d0a47c0f0ecc
1 <?php
2 /* Prototype: array lstat ( string $filename );
3 Description: Gives information about a file or symbolic link
5 Prototype: array stat ( string $filename );
6 Description: Gives information about a file
7 */
9 /* test the effects of rename() on stats of link */
11 $file_path = dirname(__FILE__);
12 require "$file_path/file.inc";
14 /* create temp file & link */
15 $fp = fopen("$file_path/lstat_stat_variation3.tmp", "w"); // temp file
16 fclose($fp);
18 // temp link
19 symlink("$file_path/lstat_stat_variation3.tmp", "$file_path/lstat_stat_variation_link3.tmp");
21 // renaming a link
22 echo "*** Testing lstat() for link after being renamed ***\n";
23 $old_linkname = "$file_path/lstat_stat_variation_link3.tmp";
24 $new_linkname = "$file_path/lstat_stat_variation_link3a.tmp";
25 $old_stat = lstat($old_linkname);
26 clearstatcache();
27 var_dump( rename($old_linkname, $new_linkname) );
28 $new_stat = lstat($new_linkname);
30 // compare self stats
31 var_dump( compare_self_stat($old_stat) );
32 var_dump( compare_self_stat($new_stat) );
34 // compare the two stats - all except ctime
35 $keys_to_compare = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12,
36 "dev", "ino", "mode", "nlink", "uid", "gid",
37 "rdev", "size", "atime", "mtime", "blksize", "blocks");
38 var_dump( compare_stats($old_stat, $new_stat, $keys_to_compare) );
40 ===Done===<?php
41 $file_path = dirname(__FILE__);
42 unlink("$file_path/lstat_stat_variation3.tmp");
43 unlink("$file_path/lstat_stat_variation_link3a.tmp");