copy_variation10.phpt 989 B

12345678910111213141516171819202122232425262728293031323334353637
  1. --TEST--
  2. Test copy() function: usage variations - identical names
  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. /* Test copy(): Try copying source file to desntination file, where destination file name is identical to source name */
  10. $file_path = dirname(__FILE__);
  11. echo "*** Test copy(): Trying to create a copy of file with the same source name ***\n";
  12. $file = $file_path."/copy_variation10.tmp";
  13. $file_handle = fopen($file, "w");
  14. fwrite($file_handle, str_repeat(b"Hello2world...\n", 100));
  15. fclose($file_handle);
  16. var_dump( copy($file, $file) );
  17. var_dump( file_exists($file) );
  18. var_dump( filesize($file) );
  19. echo "*** Done ***\n";
  20. ?>
  21. --CLEAN--
  22. <?php
  23. unlink(dirname(__FILE__)."/copy_variation10.tmp");
  24. ?>
  25. --EXPECTF--
  26. *** Test copy(): Trying to create a copy of file with the same source name ***
  27. bool(false)
  28. bool(true)
  29. int(1500)
  30. *** Done ***