1--TEST--
2Test copy() function: basic functionality
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
10echo "*** Testing copy() function: to copy file from source to destination --\n";
11
12var_dump( file_exists(__FILE__) );
13
14/* copying the file */
15$file_path = dirname(__FILE__);
16$file_name1 = $file_path."/copy_basic1.tmp";
17$file_name2 = $file_path."/copy_basic2.tmp";
18var_dump( copy(__FILE__, $file_name1) );
19var_dump( copy($file_name1, $file_name2) );
20
21echo "-- Checking whether the copy of file exists --\n";
22var_dump( file_exists($file_name1) );
23var_dump( file_exists($file_name2) );
24
25echo "-- Checking filepermissions of file and its copies --\n";
26printf( "%o", fileperms(__FILE__) );
27echo "\n";
28printf( "%o", fileperms($file_name1) );
29echo "\n";
30printf( "%o", fileperms($file_name2) );
31echo "\n";
32
33echo "*** Done ***\n";
34?>
35--CLEAN--
36<?php
37$file_path = dirname(__FILE__);
38$file_name1 = $file_path."/copy_basic1.tmp";
39$file_name2 = $file_path."/copy_basic2.tmp";
40unlink($file_name1);
41unlink($file_name2);
42?>
43--EXPECTF--
44*** Testing copy() function: to copy file from source to destination --
45bool(true)
46bool(true)
47bool(true)
48-- Checking whether the copy of file exists --
49bool(true)
50bool(true)
51-- Checking filepermissions of file and its copies --
52%d
53%d
54%d
55*** Done ***
56