|
| 1 | +--TEST-- |
| 2 | +Test ftp_ssl_connect() function : error conditions |
| 3 | +--SKIPIF-- |
| 4 | +<?php |
| 5 | +$ssl = 1; |
| 6 | +require 'skipif.inc'; |
| 7 | +if (!function_exists("ftp_ssl_connect")) die("skip ftp_ssl is disabled"); |
| 8 | +?> |
| 9 | +--FILE-- |
| 10 | +<?php |
| 11 | +echo "*** Testing ftp_ssl_connect() function : error conditions ***\n"; |
| 12 | +echo "\n-- Testing ftp_ssl_connect() function on failure --\n"; |
| 13 | +var_dump(ftp_ssl_connect('totes.invalid')); |
| 14 | + |
| 15 | +echo "\n-- Testing ftp_ssl_connect() function invalid argument type --\n"; |
| 16 | +ftp_ssl_connect([]); |
| 17 | +ftp_ssl_connect('totes.invalid', []); |
| 18 | +ftp_ssl_connect('totes.invalid', 21, []); |
| 19 | + |
| 20 | +echo "\n-- Testing ftp_ssl_connect() function with more than expected no. of arguments --\n"; |
| 21 | +ftp_ssl_connect('totes.invalid', 21, 1, []); |
| 22 | + |
| 23 | +echo "\n-- Testing ftp_ssl_connect() function timeout warning for value 0 --\n"; |
| 24 | +ftp_ssl_connect('totes.invalid', 21, 0); |
| 25 | + |
| 26 | +echo "===DONE===\n"; |
| 27 | + |
| 28 | +--EXPECTF-- |
| 29 | +*** Testing ftp_ssl_connect() function : error conditions *** |
| 30 | + |
| 31 | +-- Testing ftp_ssl_connect() function on failure -- |
| 32 | + |
| 33 | +Warning: ftp_ssl_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in %s on line %d |
| 34 | +bool(false) |
| 35 | + |
| 36 | +-- Testing ftp_ssl_connect() function invalid argument type -- |
| 37 | + |
| 38 | +Warning: ftp_ssl_connect() expects parameter 1 to be string, array given in %s on line %d |
| 39 | + |
| 40 | +Warning: ftp_ssl_connect() expects parameter 2 to be integer, array given in %s on line %d |
| 41 | + |
| 42 | +Warning: ftp_ssl_connect() expects parameter 3 to be integer, array given in %s on line %d |
| 43 | + |
| 44 | +-- Testing ftp_ssl_connect() function with more than expected no. of arguments -- |
| 45 | + |
| 46 | +Warning: ftp_ssl_connect() expects at most 3 parameters, 4 given in %s on line %d |
| 47 | + |
| 48 | +-- Testing ftp_ssl_connect() function timeout warning for value 0 -- |
| 49 | + |
| 50 | +Warning: ftp_ssl_connect(): Timeout has to be greater than 0 in %s on line %d |
| 51 | +===DONE=== |
0 commit comments