xref: /PHP-7.1/ext/ftp/tests/ftp_nb_get_large.phpt (revision 9c1e1bbc)
1--TEST--
2Testing ftp_nb_fget can handle large files incl. resume
3--SKIPIF--
4<?php
5require 'skipif.inc';
6if (2147483647 == PHP_INT_MAX) {
7    die('skip ot supported on this system');
8}
9if (disk_free_space(__DIR__) < 10*1024*1024*1024) {
10    die('not enough disk space');
11}
12?>
13--FILE--
14<?php
15require 'server.inc';
16
17$ftp = ftp_connect('127.0.0.1', $port);
18ftp_login($ftp, 'user', 'pass');
19if (!$ftp) die("Couldn't connect to the server");
20
21$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_get_large.txt";
22touch($local_file);
23ftp_nb_get($ftp, $local_file, 'fget_large.txt', FTP_BINARY, 5368709119);
24$fp = fopen($local_file, 'r');
25fseek($fp, 5368709119);
26var_dump(fread($fp, 1));
27var_dump(filesize($local_file));
28fclose($fp);
29?>
30--CLEAN--
31<?php
32@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_get_large.txt");
33?>
34--EXPECT--
35string(1) "X"
36int(5368709120)
37