Annotation of embedaddon/php/ext/ftp/tests/ftp_get_basic.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: FTP ftp_get file for both binary and ASCII transfer modes 
        !             3: --CREDITS--
        !             4: Nathaniel McHugh
        !             5: --SKIPIF--
        !             6: <?php
        !             7: require 'skipif.inc';
        !             8: ?>
        !             9: --FILE--
        !            10: <?php
        !            11: require 'server.inc';
        !            12: 
        !            13: $ftp = ftp_connect('127.0.0.1', $port);
        !            14: if (!$ftp) die("Couldn't connect to the server");
        !            15: 
        !            16: var_dump(ftp_login($ftp, 'user', 'pass'));
        !            17: 
        !            18: //test simple text transfer
        !            19: $tmpfname = tempnam(dirname(__FILE__), "ftp_test");
        !            20: var_dump(ftp_get($ftp, $tmpfname ,'a story.txt', FTP_ASCII));
        !            21: echo file_get_contents($tmpfname);
        !            22: unlink($tmpfname);
        !            23: 
        !            24: //test binary data transfer
        !            25: $tmpfname = tempnam(dirname(__FILE__), "ftp_test");
        !            26: var_dump(ftp_get($ftp, $tmpfname, 'binary data.bin', FTP_BINARY));
        !            27: var_dump(urlencode(file_get_contents($tmpfname)));
        !            28: unlink($tmpfname);
        !            29: 
        !            30: //test non-existant file request 
        !            31: ftp_get($ftp, $tmpfname ,'a warning.txt', FTP_ASCII);
        !            32: ?>
        !            33: --EXPECTF--
        !            34: bool(true)
        !            35: bool(true)
        !            36: For sale: baby shoes, never worn.
        !            37: bool(true)
        !            38: string(21) "BINARYFoo%00Bar%0D%0A"
        !            39: 
        !            40: Warning: ftp_get(): a warning: No such file or directory  in %sftp_get_basic.php on line %d

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>