ftp_delete.phpt 911 B

1234567891011121314151617181920212223242526272829303132
  1. --TEST--
  2. Testing ftp_delete basic functionality
  3. --CREDITS--
  4. Gabriel Caruso (carusogabriel34@gmail.com)
  5. Contributed by Ward Cappelle <wardcappelle@gmail.com>
  6. User Group: PHP-WVL & PHPGent #PHPTestFest
  7. --EXTENSIONS--
  8. ftp
  9. pcntl
  10. --FILE--
  11. <?php
  12. require 'server.inc';
  13. $ftp = ftp_connect('127.0.0.1', $port);
  14. ftp_login($ftp, 'user', 'pass');
  15. $ftp or die("Couldn't connect to the server");
  16. echo "Test case #1: removal of existing file from FTP, should return true:", PHP_EOL;
  17. var_dump(ftp_delete($ftp, 'file1'));
  18. echo "Test case #2: removal of non-existent file from FTP, should return false:", PHP_EOL;
  19. var_dump(ftp_delete($ftp, 'false-file.boo'));
  20. ftp_close($ftp);
  21. ?>
  22. --EXPECTF--
  23. Test case #1: removal of existing file from FTP, should return true:
  24. bool(true)
  25. Test case #2: removal of non-existent file from FTP, should return false:
  26. Warning: ftp_delete(): No such file or directory in %s on line %d
  27. bool(false)