import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-file / copy_variation11.php
blobac12c5e0b84d6c1992657a3da3059cf913a908fa
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 the file to a destination, where destination is an existing dir */
9 $file_path = dirname(__FILE__);
11 echo "*** Test copy() function: Trying to create a copy of source file as a dir ***\n";
12 $file = $file_path."/copy_variation11.tmp";
13 $file_handle = fopen($file, "w");
14 fwrite($file_handle, str_repeat(b"Hello, world...", 20));
15 fclose($file_handle);
17 $dir = $file_path."/copy_variation11";
18 mkdir($dir);
20 echo "Size of source before copy operation => ";
21 var_dump( filesize($file) ); //size of source before copy
22 clearstatcache();
23 echo "Size of destination before copy operation => ";
24 var_dump( filesize($dir) ); //size of destination before copy
25 clearstatcache();
27 echo "\n-- Now applying copy() operation --\n";
28 var_dump( copy($file, $dir) ); //expected: bool(false)
30 var_dump( file_exists($file) ); //expected: bool(true)
31 var_dump( file_exists($dir) ); //expected: bool(true)
33 var_dump( is_file($file) ); //expected: bool(true)
34 var_dump( is_dir($file) ); //expected: bool(false)
36 var_dump( is_file($dir) ); //expected: bool(false)
37 var_dump( is_dir($dir) ); //expected: bool(true)
39 var_dump( filesize($file) ); //size of source after copy
40 var_dump( filesize($dir) ); //size of destination after copy
42 echo "*** Done ***\n";
44 <?php
45 unlink(dirname(__FILE__)."/copy_variation11.tmp");
46 rmdir(dirname(__FILE__)."/copy_variation11");