From: Gabriel Caruso Date: Sun, 18 Feb 2018 22:45:39 +0000 (-0300) Subject: Test more functions of ftp X-Git-Tag: php-7.3.0alpha1~354 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5153413ed467b10276e4ebeba741fa1aad086d07;p=php Test more functions of ftp --- diff --git a/ext/ftp/tests/ftp_delete.phpt b/ext/ftp/tests/ftp_delete.phpt new file mode 100644 index 0000000000..2883aa5341 --- /dev/null +++ b/ext/ftp/tests/ftp_delete.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing ftp_delete basic functionality +--CREDITS-- +Gabriel Caruso (carusogabriel34@gmail.com) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(true) diff --git a/ext/ftp/tests/ftp_fput.phpt b/ext/ftp/tests/ftp_fput.phpt new file mode 100644 index 0000000000..7d53283e3d --- /dev/null +++ b/ext/ftp/tests/ftp_fput.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing ftp_fput basic functionality +--CREDITS-- +Gabriel Caruso (carusogabriel34@gmail.com) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(true) diff --git a/ext/ftp/tests/ftp_get_option.phpt b/ext/ftp/tests/ftp_get_option.phpt new file mode 100644 index 0000000000..06b34fc720 --- /dev/null +++ b/ext/ftp/tests/ftp_get_option.phpt @@ -0,0 +1,27 @@ +--TEST-- +Testing ftp_get_option basic functionality +--CREDITS-- +Gabriel Caruso (carusogabriel34@gmail.com) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +int(%d) +bool(true) +bool(true) + +Warning: ftp_get_option(): Unknown option '10' in %s on line %d +bool(false) diff --git a/ext/ftp/tests/ftp_nb_fput.phpt b/ext/ftp/tests/ftp_nb_fput.phpt new file mode 100644 index 0000000000..1ec09283dd --- /dev/null +++ b/ext/ftp/tests/ftp_nb_fput.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing ftp_nb_fput basic functionality +--CREDITS-- +Gabriel Caruso (carusogabriel34@gmail.com) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +int(1) diff --git a/ext/ftp/tests/ftp_nb_put.phpt b/ext/ftp/tests/ftp_nb_put.phpt new file mode 100644 index 0000000000..691c35aa46 --- /dev/null +++ b/ext/ftp/tests/ftp_nb_put.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing ftp_nb_put basic functionality +--CREDITS-- +Gabriel Caruso (carusogabriel34@gmail.com) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +int(1) diff --git a/ext/ftp/tests/ftp_pasv.phpt b/ext/ftp/tests/ftp_pasv.phpt new file mode 100644 index 0000000000..318f1ca72c --- /dev/null +++ b/ext/ftp/tests/ftp_pasv.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing ftp_pasv basic funcionality +--CREDITS-- +Gabriel Caruso (carusogabriel34@gmail.com) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(true) diff --git a/ext/ftp/tests/ftp_rawlist_basic1.phpt b/ext/ftp/tests/ftp_rawlist_basic1.phpt new file mode 100644 index 0000000000..5a706ad710 --- /dev/null +++ b/ext/ftp/tests/ftp_rawlist_basic1.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing ftp_rawlist basic functionality +--CREDITS-- +Gabriel Caruso (carusogabriel34@gmail.com) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(true) diff --git a/ext/ftp/tests/ftp_set_option.phpt b/ext/ftp/tests/ftp_set_option.phpt new file mode 100644 index 0000000000..675b4008f5 --- /dev/null +++ b/ext/ftp/tests/ftp_set_option.phpt @@ -0,0 +1,22 @@ +--TEST-- +Testing ftp_set_option basic functionality +--CREDITS-- +Gabriel Caruso (carusogabriel34@gmail.com) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(true) diff --git a/ext/ftp/tests/ftp_set_option_errors.phpt b/ext/ftp/tests/ftp_set_option_errors.phpt new file mode 100644 index 0000000000..1ad8a072c9 --- /dev/null +++ b/ext/ftp/tests/ftp_set_option_errors.phpt @@ -0,0 +1,36 @@ +--TEST-- +Testing ftp_set_option erros while setting up +--CREDITS-- +Gabriel Caruso (carusogabriel34@gmail.com) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: ftp_set_option(): Timeout has to be greater than 0 in %s on line %d +bool(false) + +Warning: ftp_set_option(): Option TIMEOUT_SEC expects value of type int, string given in %s on line %d +bool(false) + +Warning: ftp_set_option(): Option USEPASVADDRESS expects value of type bool, array given in %s on line %d +bool(false) + +Warning: ftp_set_option(): Option AUTOSEEK expects value of type bool, string given in %s on line %d +bool(false) + +Warning: ftp_set_option(): Unknown option '10' in %s on line %d +bool(false) diff --git a/ext/ftp/tests/server.inc b/ext/ftp/tests/server.inc index d94844b218..fb9ff57225 100644 --- a/ext/ftp/tests/server.inc +++ b/ext/ftp/tests/server.inc @@ -454,11 +454,13 @@ if ($pid) { } elseif (preg_match('/^SITE CHMOD/', $buf, $matches)) { fputs($s, "200 OK\r\n"); + } elseif (preg_match('/^DELE/', $buf, $matches)) { + fputs($s, "250 OK\r\n"); + } elseif (preg_match('/^ALLO (\d+)/', $buf, $matches)) { fputs($s, "200 " . $matches[1] . " bytes allocated\r\n"); }elseif (preg_match('/^LIST www\//', $buf, $matches)) { - fputs($s, "150 Opening ASCII mode data connection for file list\r\n"); fputs($s, "226 Transfer complete\r\n"); }elseif (preg_match('/^LIST no_exists\//', $buf, $matches)) {