diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/ftp/tests/ftp_get_basic.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/ftp/tests/ftp_get_basic.phpt')
-rw-r--r-- | ext/ftp/tests/ftp_get_basic.phpt | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/ext/ftp/tests/ftp_get_basic.phpt b/ext/ftp/tests/ftp_get_basic.phpt new file mode 100644 index 0000000..23fd8d0 --- /dev/null +++ b/ext/ftp/tests/ftp_get_basic.phpt @@ -0,0 +1,40 @@ +--TEST-- +FTP ftp_get file for both binary and ASCII transfer modes +--CREDITS-- +Nathaniel McHugh +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +if (!$ftp) die("Couldn't connect to the server"); + +var_dump(ftp_login($ftp, 'user', 'pass')); + +//test simple text transfer +$tmpfname = tempnam(dirname(__FILE__), "ftp_test"); +var_dump(ftp_get($ftp, $tmpfname ,'a story.txt', FTP_ASCII)); +echo file_get_contents($tmpfname); +unlink($tmpfname); + +//test binary data transfer +$tmpfname = tempnam(dirname(__FILE__), "ftp_test"); +var_dump(ftp_get($ftp, $tmpfname, 'binary data.bin', FTP_BINARY)); +var_dump(urlencode(file_get_contents($tmpfname))); +unlink($tmpfname); + +//test non-existant file request +ftp_get($ftp, $tmpfname ,'a warning.txt', FTP_ASCII); +?> +--EXPECTF-- +bool(true) +bool(true) +For sale: baby shoes, never worn. +bool(true) +string(21) "BINARYFoo%00Bar%0D%0A" + +Warning: ftp_get(): a warning: No such file or directory in %sftp_get_basic.php on line %d |