xref: /PHP-7.4/ext/ftp/tests/ftp_append.phpt (revision ded3d984)
1--TEST--
2ftp_append() create new file and append something
3--SKIPIF--
4<?php
5require 'skipif.inc';
6?>
7--FILE--
8<?php
9require 'server.inc';
10
11$ftp = ftp_connect('127.0.0.1', $port);
12if (!$ftp) die("Couldn't connect to the server");
13
14var_dump(ftp_login($ftp, 'user', 'pass'));
15
16$fooPath = __DIR__ . '/ftp_append_foo';
17file_put_contents($fooPath, 'foo');
18var_dump(ftp_append($ftp, 'ftp_append_foobar', $fooPath, FTP_BINARY));
19
20$barPath = __DIR__ . '/ftp_append_bar';
21file_put_contents($barPath, 'bar');
22var_dump(ftp_append($ftp, 'ftp_append_foobar', $barPath, FTP_BINARY));
23
24$fooBarPath = __DIR__ . '/ftp_append_foobar';
25var_dump(file_get_contents($fooBarPath));
26
27ftp_close($ftp);
28?>
29--CLEAN--
30<?php
31$fooPath = __DIR__ . '/ftp_append_foo';
32unlink($fooPath);
33$barPath = __DIR__ . '/ftp_append_bar';
34unlink($barPath);
35$fooBarPath = __DIR__ . '/ftp_append_foobar';
36unlink($fooBarPath);
37?>
38--EXPECT--
39bool(true)
40bool(true)
41bool(true)
42string(6) "foobar"
43