1--TEST--
2Test copy() function: usage variations - stat after copy
3--FILE--
4<?php
5/* Test copy(): checking stat of file before and after after copy operation */
6
7$file_path = __DIR__;
8
9require($file_path."/file.inc");
10
11echo "*** Test copy() function: stat of file before and after copy ***\n";
12$src_file_name = $file_path."/copy_variation18.tmp";
13$file_handle =  fopen($src_file_name, "w");
14fwrite($file_handle, str_repeat("Hello2world...\n", 100));
15fclose($file_handle);
16
17$dest_file_name = $file_path."/copy_copy_variation18.tmp";
18
19clearstatcache();
20
21$stat_before_copy = stat($src_file_name);
22clearstatcache();
23
24echo "Copy operation => ";
25var_dump( copy($src_file_name, $dest_file_name) );
26
27$stat_after_copy = stat($src_file_name);
28clearstatcache();
29
30// compare all stat fields except access time
31$stat_keys_to_compare = array("dev", "ino", "mode", "nlink", "uid", "gid",
32                       "rdev", "size", "mtime", "ctime",
33                       "blksize", "blocks");
34
35echo "Comparing the stats of file before and after copy operation => ";
36var_dump( compare_stats($stat_before_copy, $stat_after_copy, $stat_keys_to_compare) );
37
38echo "*** Done ***\n";
39?>
40--CLEAN--
41<?php
42unlink(__DIR__."/copy_copy_variation18.tmp");
43unlink(__DIR__."/copy_variation18.tmp");
44?>
45--EXPECT--
46*** Test copy() function: stat of file before and after copy ***
47Copy operation => bool(true)
48Comparing the stats of file before and after copy operation => bool(true)
49*** Done ***
50