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