import zend standard tests
[hiphop-php.git] / hphp / test / zend / good / ext-standard-file / copy_variation5.php
blob09f33a538f1bbfc8e9601177d36c82b8bebfd946
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() function: Checking case sensitivity in creation of destination file names
8 and the existence and size of destination files
9 */
11 echo "*** Test copy() function: checking case sensitivity in creation of destination file names ***\n";
12 $file_path = dirname(__FILE__);
13 $src_file_name = $file_path."/copy_variation5.tmp";
14 $file_handle = fopen($src_file_name, "w");
15 fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) );
16 fclose($file_handle);
18 /* array of destination file names */
19 $dest_files = array(
21 /* Checking case sensitiveness */
22 "COPY.tmp",
23 "COPY.TMP",
24 "CopY.TMP"
27 echo "Size of the source file before copy operation => ";
28 var_dump( filesize($src_file_name) );
29 clearstatcache();
31 echo "\n-- Now applying copy() on source file to create copies --";
32 $count = 1;
33 foreach($dest_files as $dest_file) {
35 echo "\n-- Iteration $count --\n";
36 $dest_file_name = $file_path."/$dest_file";
38 echo "Copy operation => ";
39 var_dump( copy($src_file_name, $dest_file_name) );
41 echo "Existence of destination file => ";
42 var_dump( file_exists($dest_file_name) );
44 echo "Destination file name => ";
45 print($dest_file_name);
46 echo "\n";
48 echo "Size of source file => ";
49 var_dump( filesize($src_file_name) );
50 clearstatcache();
52 echo "Size of destination file => ";
53 var_dump( filesize($dest_file_name) );
54 clearstatcache();
56 $count++;
59 $count = 1;
60 foreach($dest_files as $dest_file) {
61 unlink($file_path."/".$dest_file);
62 $count++;
65 echo "*** Done ***\n";
67 <?php
68 unlink(dirname(__FILE__)."/copy_variation5.tmp");