import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-file / copy_variation18.php
blob682ceaed9936fb1f9ac8c63783ee2f93fee2a1da
1 <?php
2 /* Prototype: bool copy ( string $source, string $dest );
3 Description: Makes a copy of the file source to dest.
4 Returns TRUE on success or FALSE on failure.
5 */
7 /* Test copy(): checking stat of file before and after after copy operation */
9 $file_path = dirname(__FILE__);
11 require($file_path."/file.inc");
13 echo "*** Test copy() function: stat of file before and after copy ***\n";
14 $src_file_name = $file_path."/copy_variation18.tmp";
15 $file_handle = fopen($src_file_name, "w");
16 fwrite($file_handle, str_repeat("Hello2world...\n", 100));
17 fclose($file_handle);
19 $dest_file_name = $file_path."/copy_copy_variation18.tmp";
21 clearstatcache();
23 $stat_before_copy = stat($src_file_name);
24 clearstatcache();
26 echo "Copy operation => ";
27 var_dump( copy($src_file_name, $dest_file_name) );
29 $stat_after_copy = stat($src_file_name);
30 clearstatcache();
32 // compare all stat fields except access time
33 $stat_keys_to_compare = array("dev", "ino", "mode", "nlink", "uid", "gid",
34 "rdev", "size", "mtime", "ctime",
35 "blksize", "blocks");
37 echo "Comparing the stats of file before and after copy operation => ";
38 var_dump( compare_stats($stat_before_copy, $stat_after_copy, $stat_keys_to_compare) );
40 echo "*** Done ***\n";
42 <?php
43 unlink(dirname(__FILE__)."/copy_copy_variation18.tmp");
44 unlink(dirname(__FILE__)."/copy_variation18.tmp");