xref: /PHP-8.0/ext/ftp/tests/ftp_delete.phpt (revision f9d66cad)
1--TEST--
2Testing ftp_delete basic functionality
3--CREDITS--
4Gabriel Caruso (carusogabriel34@gmail.com)
5Contributed by Ward Cappelle <wardcappelle@gmail.com>
6User Group: PHP-WVL & PHPGent #PHPTestFest
7--SKIPIF--
8<?php require 'skipif.inc'; ?>
9--FILE--
10<?php
11require 'server.inc';
12
13$ftp = ftp_connect('127.0.0.1', $port);
14ftp_login($ftp, 'user', 'pass');
15$ftp or die("Couldn't connect to the server");
16
17echo "Test case #1: removal of existing file from FTP, should return true:", PHP_EOL;
18var_dump(ftp_delete($ftp, 'file1'));
19
20echo "Test case #2: removal of non-existent file from FTP, should return false:", PHP_EOL;
21var_dump(ftp_delete($ftp, 'false-file.boo'));
22
23ftp_close($ftp);
24?>
25--EXPECTF--
26Test case #1: removal of existing file from FTP, should return true:
27bool(true)
28Test case #2: removal of non-existent file from FTP, should return false:
29
30Warning: ftp_delete(): No such file or directory in %s on line %d
31bool(false)
32