1--TEST--
2Test copy() function: usage variations - destination file names(case sensitive)
3--SKIPIF--
4<?php
5if(substr(PHP_OS, 0, 3) != "WIN")
6  die("skip only run on Windows");
7?>
8--FILE--
9<?php
10/* Test copy() function: Checking case sensitivity in creation of destination file names
11     and the existence and size of destination files
12*/
13
14echo "*** Test copy() function: checking case sensitivity in creation of destination file names ***\n";
15$file_path = __DIR__;
16$src_file_name = $file_path."/copy_variation5.tmp";
17$file_handle = fopen($src_file_name, "w");
18fwrite( $file_handle, str_repeat("Hello2World...\n", 100) );
19fclose($file_handle);
20
21/* array of destination file names */
22$dest_files = array(
23
24  /* Checking case sensitiveness */
25  "COPY.tmp",
26  "COPY.TMP",
27  "CopY.TMP"
28);
29
30echo "Size of the source file before copy operation => ";
31var_dump( filesize($src_file_name) );
32clearstatcache();
33
34echo "\n-- Now applying copy() on source file to create copies --";
35$count = 1;
36foreach($dest_files as $dest_file) {
37
38  echo "\n-- Iteration $count --\n";
39  $dest_file_name = $file_path."/$dest_file";
40
41  echo "Copy operation => ";
42  var_dump( copy($src_file_name, $dest_file_name) );
43
44  echo "Existence of destination file => ";
45  var_dump( file_exists($dest_file_name) );
46
47  echo "Destination file name => ";
48  print($dest_file_name);
49  echo "\n";
50
51  echo "Size of source file => ";
52  var_dump( filesize($src_file_name) );
53  clearstatcache();
54
55  echo "Size of destination file => ";
56  var_dump( filesize($dest_file_name) );
57  clearstatcache();
58
59  $count++;
60}
61
62
63$count = 1;
64foreach($dest_files as $dest_file) {
65  unlink($file_path."/".$dest_file);
66  $count++;
67}
68
69echo "*** Done ***\n";
70?>
71--CLEAN--
72<?php
73unlink(__DIR__."/copy_variation5.tmp");
74?>
75--EXPECTF--
76*** Test copy() function: checking case sensitivity in creation of destination file names ***
77Size of the source file before copy operation => int(1500)
78
79-- Now applying copy() on source file to create copies --
80-- Iteration 1 --
81Copy operation => bool(true)
82Existence of destination file => bool(true)
83Destination file name => %s/COPY.tmp
84Size of source file => int(1500)
85Size of destination file => int(1500)
86
87-- Iteration 2 --
88Copy operation => bool(true)
89Existence of destination file => bool(true)
90Destination file name => %s/COPY.TMP
91Size of source file => int(1500)
92Size of destination file => int(1500)
93
94-- Iteration 3 --
95Copy operation => bool(true)
96Existence of destination file => bool(true)
97Destination file name => %s/CopY.TMP
98Size of source file => int(1500)
99Size of destination file => int(1500)
100
101Warning: unlink(%s/COPY.TMP): No such file or directory in %s on line %d
102
103Warning: unlink(%s/CopY.TMP): No such file or directory in %s on line %d
104*** Done ***
105