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
36--CLEAN--
37<?php
38$file_path = dirname(__FILE__);
39$file_name1 = $file_path."/copy_basic1.tmp";
40$file_name2 = $file_path."/copy_basic2.tmp";
41unlink($file_name1);
42unlink($file_name2);
43?>
44
45--EXPECTF--
46*** Testing copy() function: to copy file from source to destination --
47bool(true)
48bool(true)
49bool(true)
50-- Checking whether the copy of file exists --
51bool(true)
52bool(true)
53-- Checking filepermissions of file and its copies --
54%d
55%d
56%d
57*** Done ***
58
59