ftp_append.phpt 927 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --TEST--
  2. ftp_append() create new file and append something
  3. --EXTENSIONS--
  4. ftp
  5. pcntl
  6. --FILE--
  7. <?php
  8. require 'server.inc';
  9. $ftp = ftp_connect('127.0.0.1', $port);
  10. if (!$ftp) die("Couldn't connect to the server");
  11. var_dump(ftp_login($ftp, 'user', 'pass'));
  12. $fooPath = __DIR__ . '/ftp_append_foo';
  13. file_put_contents($fooPath, 'foo');
  14. var_dump(ftp_append($ftp, 'ftp_append_foobar', $fooPath, FTP_BINARY));
  15. $barPath = __DIR__ . '/ftp_append_bar';
  16. file_put_contents($barPath, 'bar');
  17. var_dump(ftp_append($ftp, 'ftp_append_foobar', $barPath, FTP_BINARY));
  18. $fooBarPath = __DIR__ . '/ftp_append_foobar';
  19. var_dump(file_get_contents($fooBarPath));
  20. ftp_close($ftp);
  21. ?>
  22. --CLEAN--
  23. <?php
  24. $fooPath = __DIR__ . '/ftp_append_foo';
  25. unlink($fooPath);
  26. $barPath = __DIR__ . '/ftp_append_bar';
  27. unlink($barPath);
  28. $fooBarPath = __DIR__ . '/ftp_append_foobar';
  29. unlink($fooBarPath);
  30. ?>
  31. --EXPECT--
  32. bool(true)
  33. bool(true)
  34. bool(true)
  35. string(6) "foobar"