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