copy_basic.phpt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. --TEST--
  2. Test copy() function: basic functionality
  3. --FILE--
  4. <?php
  5. echo "*** Testing copy() function: to copy file from source to destination --\n";
  6. var_dump( file_exists(__FILE__) );
  7. /* copying the file */
  8. $file_path = __DIR__;
  9. $file_name1 = $file_path."/copy_basic1.tmp";
  10. $file_name2 = $file_path."/copy_basic2.tmp";
  11. var_dump( copy(__FILE__, $file_name1) );
  12. var_dump( copy($file_name1, $file_name2) );
  13. echo "-- Checking whether the copy of file exists --\n";
  14. var_dump( file_exists($file_name1) );
  15. var_dump( file_exists($file_name2) );
  16. echo "-- Checking filepermissions of file and its copies --\n";
  17. printf( "%o", fileperms(__FILE__) );
  18. echo "\n";
  19. printf( "%o", fileperms($file_name1) );
  20. echo "\n";
  21. printf( "%o", fileperms($file_name2) );
  22. echo "\n";
  23. echo "*** Done ***\n";
  24. ?>
  25. --CLEAN--
  26. <?php
  27. $file_path = __DIR__;
  28. $file_name1 = $file_path."/copy_basic1.tmp";
  29. $file_name2 = $file_path."/copy_basic2.tmp";
  30. unlink($file_name1);
  31. unlink($file_name2);
  32. ?>
  33. --EXPECTF--
  34. *** Testing copy() function: to copy file from source to destination --
  35. bool(true)
  36. bool(true)
  37. bool(true)
  38. -- Checking whether the copy of file exists --
  39. bool(true)
  40. bool(true)
  41. -- Checking filepermissions of file and its copies --
  42. %d
  43. %d
  44. %d
  45. *** Done ***