Annotation of embedaddon/php/ext/standard/tests/file/copy_variation18.phpt, revision 1.1.1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>