xref: /PHP-8.1/ext/ftp/tests/ftp_delete.phpt (revision e9f783fc)
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--EXTENSIONS--
8ftp
9pcntl
10--FILE--
11<?php
12require 'server.inc';
13
14$ftp = ftp_connect('127.0.0.1', $port);
15ftp_login($ftp, 'user', 'pass');
16$ftp or die("Couldn't connect to the server");
17
18echo "Test case #1: removal of existing file from FTP, should return true:", PHP_EOL;
19var_dump(ftp_delete($ftp, 'file1'));
20
21echo "Test case #2: removal of non-existent file from FTP, should return false:", PHP_EOL;
22var_dump(ftp_delete($ftp, 'false-file.boo'));
23
24ftp_close($ftp);
25?>
26--EXPECTF--
27Test case #1: removal of existing file from FTP, should return true:
28bool(true)
29Test case #2: removal of non-existent file from FTP, should return false:
30
31Warning: ftp_delete(): No such file or directory in %s on line %d
32bool(false)
33