Annotation of embedaddon/php/ext/standard/tests/file/copy_variation17.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test copy() function: usage variations - wildcard chars in source
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 the source file which is given with the combination of wild-card chars */
11:
12: $file_path = dirname(__FILE__);
13:
14: echo "*** Test copy() function: With source file names containing wild-card chars ***\n";
15: $src_file = $file_path."/copy_variation17.tmp";
16: $file_handle = fopen($src_file, "w");
17: fwrite($file_handle, str_repeat(b"Hello2world...\n", 100));
18: fclose($file_handle);
19:
20: $dir = $file_path."/copy_variation17";
21: mkdir($dir);
22:
23: $src_file_names = array(
24: $file_path."/copy_variation17.tmp", //without wild-card char
25: $file_path."/copy*17.tmp",
26: $file_path."/*_variation17.tmp",
27: $file_path."/copy_variation*.tmp",
28: $file_path."/*.tmp"
29: );
30:
31: $dest_file_name = $dir."/copy_copy_variation17.tmp";
32:
33: $count = 1;
34: foreach($src_file_names as $src_file_name) {
35: var_dump( copy($src_file_name, $dest_file_name) );
36: var_dump( file_exists($dest_file_name) );
37:
38: if( file_exists($dest_file_name) ) {
39: var_dump( filesize($dest_file_name) ); //size of destination
40: unlink($dest_file_name);
41: }
42:
43: $count++;
44: }
45:
46: echo "*** Done ***\n";
47: ?>
48:
49: --CLEAN--
50: <?php
51: unlink(dirname(__FILE__)."/copy_variation17.tmp");
52: rmdir(dirname(__FILE__)."/copy_variation17");
53: ?>
54:
55: --EXPECTF--
56: *** Test copy() function: With source file names containing wild-card chars ***
57: bool(true)
58: bool(true)
59: int(1500)
60:
61: Warning: copy(%s): %s
62: bool(false)
63: bool(false)
64:
65: Warning: copy(%s): %s
66: bool(false)
67: bool(false)
68:
69: Warning: copy(%s): %s
70: bool(false)
71: bool(false)
72:
73: Warning: copy(%s): %s
74: bool(false)
75: bool(false)
76: *** Done ***
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>