import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-file / copy_variation2-win32.php
blob190d512fe2cde2b403fb75fbcea0bf27f8f602ce
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: In creation of destination file names containing special characters
8 and checking the existence and size of destination files
9 */
11 echo "*** Test copy() function: destination file names containing special characters ***\n";
12 $file_path = dirname(__FILE__);
13 $src_file_name = $file_path."/copy_variation2.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 /* File names containing special(non-alpha numeric) characters */
22 "_copy_variation2.tmp",
23 "@copy_variation2.tmp",
24 "#copy_variation2.tmp",
25 "+copy_variation2.tmp",
26 "?copy_variation2.tmp",
27 ">copy_variation2.tmp",
28 "!copy_variation2.tmp",
29 "&copy_variation2.tmp",
30 "(copy_variation2.tmp",
31 ":copy_variation2.tmp",
32 ";copy_variation2.tmp",
33 "=copy_variation2.tmp",
34 "[copy_variation2.tmp",
35 "^copy_variation2.tmp",
36 "{copy_variation2.tmp",
37 "|copy_variation2.tmp",
38 "~copy_variation2.tmp",
39 "\$copy_variation2.tmp"
42 echo "Size of the source file before copy operation => ";
43 var_dump( filesize("$src_file_name") );
44 clearstatcache();
46 echo "\n--- Now applying copy() on source file to create copies ---";
47 $count = 1;
48 foreach($dest_files as $dest_file) {
49 echo "\n-- Iteration $count --\n";
50 $dest_file_name = $file_path."/$dest_file";
52 echo "Copy operation => ";
53 var_dump( copy($src_file_name, $dest_file_name) );
55 echo "Existence of destination file => ";
56 var_dump( file_exists($dest_file_name) );
58 if( file_exists($dest_file_name) ) {
59 echo "Destination file name => ";
60 print($dest_file_name);
61 echo "\n";
63 echo "Size of source file => ";
64 var_dump( filesize($src_file_name) );
65 clearstatcache();
67 echo "Size of destination file => ";
68 var_dump( filesize($dest_file_name) );
69 clearstatcache();
71 unlink($dest_file_name);
73 $count++;
76 echo "*** Done ***\n";
78 <?php
79 unlink(dirname(__FILE__)."/copy_variation2.tmp");