1--TEST--
2Test copy() function: usage variations - wildcard chars in source
3--FILE--
4<?php
5/* Test copy(): Trying to copy the source file which is given with the combination of wild-card chars */
6
7$file_path = __DIR__;
8
9echo "*** Test copy() function: With source file names containing wild-card chars ***\n";
10$src_file = $file_path."/copy_variation17.tmp";
11$file_handle =  fopen($src_file, "w");
12fwrite($file_handle, str_repeat("Hello2world...\n", 100));
13fclose($file_handle);
14
15$dir = $file_path."/copy_variation17";
16mkdir($dir);
17
18$src_file_names = array(
19  $file_path."/copy_variation17.tmp",  //without wild-card char
20  $file_path."/copy*17.tmp",
21  $file_path."/*_variation17.tmp",
22  $file_path."/copy_variation*.tmp",
23  $file_path."/*.tmp"
24);
25
26$dest_file_name = $dir."/copy_copy_variation17.tmp";
27
28$count = 1;
29foreach($src_file_names as $src_file_name) {
30  var_dump( copy($src_file_name, $dest_file_name) );
31  var_dump( file_exists($dest_file_name) );
32
33  if( file_exists($dest_file_name) ) {
34  var_dump( filesize($dest_file_name) );  //size of destination
35  unlink($dest_file_name);
36  }
37
38  $count++;
39}
40
41echo "*** Done ***\n";
42?>
43--CLEAN--
44<?php
45unlink(__DIR__."/copy_variation17.tmp");
46rmdir(__DIR__."/copy_variation17");
47?>
48--EXPECTF--
49*** Test copy() function: With source file names containing wild-card chars ***
50bool(true)
51bool(true)
52int(1500)
53
54Warning: copy(%s): %s
55bool(false)
56bool(false)
57
58Warning: copy(%s): %s
59bool(false)
60bool(false)
61
62Warning: copy(%s): %s
63bool(false)
64bool(false)
65
66Warning: copy(%s): %s
67bool(false)
68bool(false)
69*** Done ***
70