1--TEST--
2Test copy() function: usage variations - non existing src/dest
3--FILE--
4<?php
5/* Test copy(): Trying to create a copy of non-existing source in an existing destination
6     and an existing source in non-existing destination */
7
8$file_path = __DIR__;
9
10echo "*** Test copy() function: Trying to create a copy of non-existing source in existing destination ***";
11$file = $file_path."/copy_variation14.tmp";
12$file_handle =  fopen($file, "w");
13fwrite($file_handle, str_repeat("Hello2world...\n", 100));
14fclose($file_handle);
15
16var_dump( copy($file_path."/nosuchfile.tmp", $file_path."/copy_nosuchfile.tmp") );  //With non-existing source
17var_dump( file_exists($file_path."/copy_nosuchfile.tmp") );
18
19echo "\n*** Test copy() function: Trying to create copy of an existing source in non-existing destination ***";
20var_dump( copy($file, $file_path."/nodir/copy_nosuchfile.tmp") );  //With non-existing dir path
21var_dump( file_exists($file_path."/nodir/copy_nosuchfile.tmp") );
22var_dump( filesize($file) );  //size of the source
23
24echo "*** Done ***\n";
25?>
26--CLEAN--
27<?php
28unlink(__DIR__."/copy_variation14.tmp");
29?>
30--EXPECTF--
31*** Test copy() function: Trying to create a copy of non-existing source in existing destination ***
32Warning: copy(%s): %s
33bool(false)
34bool(false)
35
36*** Test copy() function: Trying to create copy of an existing source in non-existing destination ***
37Warning: copy(%s): %s
38bool(false)
39bool(false)
40int(1500)
41*** Done ***
42