Annotation of embedaddon/php/ext/standard/tests/file/copy_variation13.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test copy() function: usage variations - src as dir and dest as an existing file(Bug #42243)
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:
10: /* Test copy(): Trying to copy dir to an existing file */
11:
12: echo "*** Test copy() function: Trying to copy dir to file ***\n";
13: $file_path = dirname(__FILE__);
14: $file = $file_path."/copy_variation13_dir.tmp";
15: fclose(fopen($file, "w"));
16: $dir = $file_path."/copy_variation13";
17: mkdir($dir);
18:
19: echo "*** Testing copy() in copying dir to file ***\n";
20: var_dump( copy($dir, $file) );
21:
22: var_dump( file_exists($file) );
23: var_dump( file_exists($dir) );
24:
25: var_dump( is_file($dir) );
26: var_dump( is_dir($dir) );
27:
28: var_dump( is_file($file) );
29: var_dump( is_dir($file) );
30:
31: var_dump( filesize($file) );
32: var_dump( filesize($dir) );
33:
34: echo "*** Done ***\n";
35: ?>
36:
37: --CLEAN--
38: <?php
39: unlink(dirname(__FILE__)."/copy_variation13_dir.tmp");
40: rmdir(dirname(__FILE__)."/copy_variation13");
41: ?>
42:
43: --EXPECTF--
44: *** Test copy() function: Trying to copy dir to file ***
45: *** Testing copy() in copying dir to file ***
46:
47: Warning: copy(): The first argument to copy() function cannot be a directory in %scopy_variation13.php on line %d
48: bool(false)
49: bool(true)
50: bool(true)
51: bool(false)
52: bool(true)
53: bool(true)
54: bool(false)
55: int(%d)
56: int(%d)
57: *** Done ***
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>