import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-file / copy_variation9.php
blob843d8451cfe3d2a0fb9d1cb46d3c5779a1d5346b
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(): Trying to copy source file to destination file with and without write permissions */
9 $file_path = dirname(__FILE__);
11 echo "*** Test copy() function: destination with/without write permissions ***\n";
12 $src_file_name = $file_path."/copy_variation9.tmp";
13 $file_handle = fopen($src_file_name, "w");
14 fwrite($file_handle, str_repeat(b"Hello2world...\n", 100));
15 fclose($file_handle);
17 $dest_file_name = $file_path."/copy_copy_variation9.tmp";
20 echo "\n-- With write permissions --\n";
21 var_dump( file_exists($src_file_name) );
22 var_dump( copy($src_file_name, $dest_file_name) );
23 var_dump( file_exists($dest_file_name) );
24 var_dump( filesize($dest_file_name) );
26 echo "\n-- Without write permissions --\n";
27 chmod($file_path."/copy_copy_variation9.tmp", 0555); //No write permissions
28 var_dump( file_exists($src_file_name) );
29 var_dump( copy($src_file_name, $dest_file_name) );
30 var_dump( file_exists($dest_file_name) );
31 var_dump( filesize($dest_file_name) );
33 echo "*** Done ***\n";
35 <?php
36 unlink(dirname(__FILE__)."/copy_copy_variation9.tmp");
37 unlink(dirname(__FILE__)."/copy_variation9.tmp");