xref: /PHP-7.3/ext/ftp/tests/ftp_nb_continue.phpt (revision 96cc4199)
1--TEST--
2Testing whether ftp_nb_continue() fetches more data
3--SKIPIF--
4<?php
5require 'skipif.inc';
6?>
7--FILE--
8<?php
9require 'server.inc';
10
11$file = "mediumfile.txt";
12
13$ftp = ftp_connect('127.0.0.1', $port);
14ftp_login($ftp, 'user', 'pass');
15if (!$ftp) die("Couldn't connect to the server");
16
17$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . $file;
18touch($local_file);
19
20$r = ftp_nb_get($ftp, $local_file, $file, FTP_BINARY);
21while ($r == FTP_MOREDATA) {
22    $r = ftp_nb_continue($ftp);
23}
24ftp_close($ftp);
25
26echo file_get_contents($local_file);
27?>
28--CLEAN--
29<?php
30@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "mediumfile.txt");
31?>
32--EXPECT--
33This is line 0 of the test data.
34This is line 1 of the test data.
35This is line 2 of the test data.
36This is line 3 of the test data.
37This is line 4 of the test data.
38This is line 5 of the test data.
39This is line 6 of the test data.
40This is line 7 of the test data.
41This is line 8 of the test data.
42This is line 9 of the test data.
43This is line 10 of the test data.
44This is line 11 of the test data.
45This is line 12 of the test data.
46This is line 13 of the test data.
47This is line 14 of the test data.
48This is line 15 of the test data.
49This is line 16 of the test data.
50This is line 17 of the test data.
51This is line 18 of the test data.
52This is line 19 of the test data.
53This is line 20 of the test data.
54This is line 21 of the test data.
55This is line 22 of the test data.
56This is line 23 of the test data.
57This is line 24 of the test data.
58This is line 25 of the test data.
59This is line 26 of the test data.
60This is line 27 of the test data.
61This is line 28 of the test data.
62This is line 29 of the test data.
63This is line 30 of the test data.
64This is line 31 of the test data.
65This is line 32 of the test data.
66This is line 33 of the test data.
67This is line 34 of the test data.
68This is line 35 of the test data.
69This is line 36 of the test data.
70This is line 37 of the test data.
71This is line 38 of the test data.
72This is line 39 of the test data.
73This is line 40 of the test data.
74This is line 41 of the test data.
75This is line 42 of the test data.
76This is line 43 of the test data.
77This is line 44 of the test data.
78This is line 45 of the test data.
79This is line 46 of the test data.
80This is line 47 of the test data.
81This is line 48 of the test data.
82This is line 49 of the test data.
83This is line 50 of the test data.
84This is line 51 of the test data.
85This is line 52 of the test data.
86This is line 53 of the test data.
87This is line 54 of the test data.
88This is line 55 of the test data.
89This is line 56 of the test data.
90This is line 57 of the test data.
91This is line 58 of the test data.
92This is line 59 of the test data.
93This is line 60 of the test data.
94This is line 61 of the test data.
95This is line 62 of the test data.
96This is line 63 of the test data.
97This is line 64 of the test data.
98This is line 65 of the test data.
99This is line 66 of the test data.
100This is line 67 of the test data.
101This is line 68 of the test data.
102This is line 69 of the test data.
103This is line 70 of the test data.
104This is line 71 of the test data.
105This is line 72 of the test data.
106This is line 73 of the test data.
107This is line 74 of the test data.
108This is line 75 of the test data.
109This is line 76 of the test data.
110This is line 77 of the test data.
111This is line 78 of the test data.
112This is line 79 of the test data.
113This is line 80 of the test data.
114This is line 81 of the test data.
115This is line 82 of the test data.
116This is line 83 of the test data.
117This is line 84 of the test data.
118This is line 85 of the test data.
119This is line 86 of the test data.
120This is line 87 of the test data.
121This is line 88 of the test data.
122This is line 89 of the test data.
123This is line 90 of the test data.
124This is line 91 of the test data.
125This is line 92 of the test data.
126This is line 93 of the test data.
127This is line 94 of the test data.
128This is line 95 of the test data.
129This is line 96 of the test data.
130This is line 97 of the test data.
131This is line 98 of the test data.
132This is line 99 of the test data.
133This is line 100 of the test data.
134This is line 101 of the test data.
135This is line 102 of the test data.
136This is line 103 of the test data.
137This is line 104 of the test data.
138This is line 105 of the test data.
139This is line 106 of the test data.
140This is line 107 of the test data.
141This is line 108 of the test data.
142This is line 109 of the test data.
143This is line 110 of the test data.
144This is line 111 of the test data.
145This is line 112 of the test data.
146This is line 113 of the test data.
147This is line 114 of the test data.
148This is line 115 of the test data.
149This is line 116 of the test data.
150This is line 117 of the test data.
151This is line 118 of the test data.
152This is line 119 of the test data.
153This is line 120 of the test data.
154This is line 121 of the test data.
155This is line 122 of the test data.
156This is line 123 of the test data.
157This is line 124 of the test data.
158This is line 125 of the test data.
159This is line 126 of the test data.
160This is line 127 of the test data.
161This is line 128 of the test data.
162This is line 129 of the test data.
163This is line 130 of the test data.
164This is line 131 of the test data.
165This is line 132 of the test data.
166This is line 133 of the test data.
167This is line 134 of the test data.
168This is line 135 of the test data.
169This is line 136 of the test data.
170This is line 137 of the test data.
171This is line 138 of the test data.
172This is line 139 of the test data.
173This is line 140 of the test data.
174This is line 141 of the test data.
175This is line 142 of the test data.
176This is line 143 of the test data.
177This is line 144 of the test data.
178This is line 145 of the test data.
179This is line 146 of the test data.
180This is line 147 of the test data.
181This is line 148 of the test data.
182This is line 149 of the test data.
183