diff options
author | Zoe Slattery <zoe@php.net> | 2009-08-30 09:30:13 +0000 |
---|---|---|
committer | Zoe Slattery <zoe@php.net> | 2009-08-30 09:30:13 +0000 |
commit | 6a22ec3edabebbe57f53d6f42aacbd5ad97ad7ba (patch) | |
tree | 4d0202e6e7603adf5326a9fb1fd435d702dfc7e7 /ext/ftp | |
parent | 94039c35b9183df5093c4cd6f868dad7b253bfde (diff) | |
download | php-git-6a22ec3edabebbe57f53d6f42aacbd5ad97ad7ba.tar.gz |
More tests from 2009 testfest
Diffstat (limited to 'ext/ftp')
-rwxr-xr-x | ext/ftp/tests/ftp_alloc_basic1.phpt | 21 | ||||
-rwxr-xr-x | ext/ftp/tests/ftp_alloc_basic2.phpt | 23 | ||||
-rwxr-xr-x | ext/ftp/tests/ftp_chmod_basic.phpt | 21 | ||||
-rwxr-xr-x | ext/ftp/tests/ftp_exec_basic.phpt | 21 | ||||
-rw-r--r-- | ext/ftp/tests/ftp_fget_basic1.phpt | 32 | ||||
-rw-r--r-- | ext/ftp/tests/ftp_fget_basic2.phpt | 32 | ||||
-rw-r--r-- | ext/ftp/tests/ftp_fget_basic3.phpt | 32 | ||||
-rw-r--r-- | ext/ftp/tests/ftp_nb_fget_basic1.phpt | 32 | ||||
-rw-r--r-- | ext/ftp/tests/ftp_nb_fget_basic2.phpt | 32 | ||||
-rw-r--r-- | ext/ftp/tests/ftp_nb_fget_basic3.phpt | 32 | ||||
-rw-r--r-- | ext/ftp/tests/ftp_rawlist_basic2.phpt | 21 | ||||
-rwxr-xr-x | ext/ftp/tests/ftp_rmdir_basic.phpt | 21 |
12 files changed, 320 insertions, 0 deletions
diff --git a/ext/ftp/tests/ftp_alloc_basic1.phpt b/ext/ftp/tests/ftp_alloc_basic1.phpt new file mode 100755 index 0000000000..b2bdf7440d --- /dev/null +++ b/ext/ftp/tests/ftp_alloc_basic1.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing ftp_alloc returns true +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +if (!$ftp) die("Couldn't connect to the server"); +ftp_login($ftp, 'user', 'pass'); + +var_dump(ftp_alloc($ftp, 1024)); +?> +--EXPECT-- +bool(true)
\ No newline at end of file diff --git a/ext/ftp/tests/ftp_alloc_basic2.phpt b/ext/ftp/tests/ftp_alloc_basic2.phpt new file mode 100755 index 0000000000..b9e4253fe8 --- /dev/null +++ b/ext/ftp/tests/ftp_alloc_basic2.phpt @@ -0,0 +1,23 @@ +--TEST-- +Testing ftp_alloc returns true +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +if (!$ftp) die("Couldn't connect to the server"); +ftp_login($ftp, 'user', 'pass'); + +var_dump(ftp_alloc($ftp, 1024, $result)); +var_dump($result); +?> +--EXPECT-- +bool(true) +string(20) "1024 bytes allocated"
\ No newline at end of file diff --git a/ext/ftp/tests/ftp_chmod_basic.phpt b/ext/ftp/tests/ftp_chmod_basic.phpt new file mode 100755 index 0000000000..baaa25a987 --- /dev/null +++ b/ext/ftp/tests/ftp_chmod_basic.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing ftp_chmod returns file mode +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +if (!$ftp) die("Couldn't connect to the server"); +ftp_login($ftp, 'user', 'pass'); + +var_dump(ftp_chmod($ftp, 0644, 'test.txt')); +?> +--EXPECT-- +int(420) diff --git a/ext/ftp/tests/ftp_exec_basic.phpt b/ext/ftp/tests/ftp_exec_basic.phpt new file mode 100755 index 0000000000..4a1f63e388 --- /dev/null +++ b/ext/ftp/tests/ftp_exec_basic.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing ftp_exec returns true +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +ftp_login($ftp, 'user', 'pass'); +if (!$ftp) die("Couldn't connect to the server"); + +var_dump(ftp_exec($ftp, 'ls -al')); +?> +--EXPECT-- +bool(true)
\ No newline at end of file diff --git a/ext/ftp/tests/ftp_fget_basic1.phpt b/ext/ftp/tests/ftp_fget_basic1.phpt new file mode 100644 index 0000000000..475f7183d2 --- /dev/null +++ b/ext/ftp/tests/ftp_fget_basic1.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing ftp_fget ignore autoresume if autoseek is switched off +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +ftp_login($ftp, 'user', 'pass'); +if (!$ftp) die("Couldn't connect to the server"); +ftp_set_option($ftp, FTP_AUTOSEEK, false); + +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +$handle = fopen($local_file, 'w'); + +var_dump(ftp_fget($ftp, $handle, 'fget.txt', FTP_ASCII, FTP_AUTORESUME)); +var_dump(file_get_contents($local_file)); +?> +--CLEAN-- +<?php +@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"); +?> +--EXPECT-- +bool(true) +string(12) "ASCIIFooBar +" diff --git a/ext/ftp/tests/ftp_fget_basic2.phpt b/ext/ftp/tests/ftp_fget_basic2.phpt new file mode 100644 index 0000000000..00a26752d9 --- /dev/null +++ b/ext/ftp/tests/ftp_fget_basic2.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing ftp_fget autoresume +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +ftp_login($ftp, 'user', 'pass'); +if (!$ftp) die("Couldn't connect to the server"); + +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +file_put_contents($local_file, 'ASCIIFoo'); +$handle = fopen($local_file, 'a'); + +var_dump(ftp_fget($ftp, $handle, 'fgetresume.txt', FTP_ASCII, FTP_AUTORESUME)); +var_dump(file_get_contents($local_file)); +?> +--CLEAN-- +<?php +@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"); +?> +--EXPECT-- +bool(true) +string(12) "ASCIIFooBar +" diff --git a/ext/ftp/tests/ftp_fget_basic3.phpt b/ext/ftp/tests/ftp_fget_basic3.phpt new file mode 100644 index 0000000000..b7098701ab --- /dev/null +++ b/ext/ftp/tests/ftp_fget_basic3.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing ftp_fget resume parameter +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +ftp_login($ftp, 'user', 'pass'); +if (!$ftp) die("Couldn't connect to the server"); + +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +file_put_contents($local_file, 'ASCIIFoo'); +$handle = fopen($local_file, 'a'); + +var_dump(ftp_fget($ftp, $handle, 'fgetresume.txt', FTP_ASCII, 8)); +var_dump(file_get_contents($local_file)); +?> +--CLEAN-- +<?php +@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"); +?> +--EXPECT-- +bool(true) +string(12) "ASCIIFooBar +" diff --git a/ext/ftp/tests/ftp_nb_fget_basic1.phpt b/ext/ftp/tests/ftp_nb_fget_basic1.phpt new file mode 100644 index 0000000000..cac4eec56b --- /dev/null +++ b/ext/ftp/tests/ftp_nb_fget_basic1.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing ftp_nb_fget ignore autoresume if autoseek is switched off +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +ftp_login($ftp, 'user', 'pass'); +if (!$ftp) die("Couldn't connect to the server"); +ftp_set_option($ftp, FTP_AUTOSEEK, false); + +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +$handle = fopen($local_file, 'w'); + +var_dump(ftp_nb_fget($ftp, $handle, 'fget.txt', FTP_ASCII, FTP_AUTORESUME)); +var_dump(file_get_contents($local_file)); +?> +--CLEAN-- +<?php +@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"); +?> +--EXPECT-- +int(2) +string(12) "ASCIIFooBar +" diff --git a/ext/ftp/tests/ftp_nb_fget_basic2.phpt b/ext/ftp/tests/ftp_nb_fget_basic2.phpt new file mode 100644 index 0000000000..dc92f4e23b --- /dev/null +++ b/ext/ftp/tests/ftp_nb_fget_basic2.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing ftp_nb_fget autoresume +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +ftp_login($ftp, 'user', 'pass'); +if (!$ftp) die("Couldn't connect to the server"); + +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +file_put_contents($local_file, 'ASCIIFoo'); +$handle = fopen($local_file, 'a'); + +var_dump(ftp_nb_fget($ftp, $handle, 'fgetresume.txt', FTP_ASCII, FTP_AUTORESUME)); +var_dump(file_get_contents($local_file)); +?> +--CLEAN-- +<?php +@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"); +?> +--EXPECT-- +int(2) +string(12) "ASCIIFooBar +" diff --git a/ext/ftp/tests/ftp_nb_fget_basic3.phpt b/ext/ftp/tests/ftp_nb_fget_basic3.phpt new file mode 100644 index 0000000000..d1a87c4f3d --- /dev/null +++ b/ext/ftp/tests/ftp_nb_fget_basic3.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing ftp_nb_fget resume parameter +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +ftp_login($ftp, 'user', 'pass'); +if (!$ftp) die("Couldn't connect to the server"); + +$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"; +file_put_contents($local_file, 'ASCIIFoo'); +$handle = fopen($local_file, 'a'); + +var_dump(ftp_nb_fget($ftp, $handle, 'fgetresume.txt', FTP_ASCII, 8)); +var_dump(file_get_contents($local_file)); +?> +--CLEAN-- +<?php +@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt"); +?> +--EXPECT-- +int(2) +string(12) "ASCIIFooBar +" diff --git a/ext/ftp/tests/ftp_rawlist_basic2.phpt b/ext/ftp/tests/ftp_rawlist_basic2.phpt new file mode 100644 index 0000000000..1d93643429 --- /dev/null +++ b/ext/ftp/tests/ftp_rawlist_basic2.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing ftp_rawlist returns false on server error +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +ftp_login($ftp, 'user', 'pass'); +if (!$ftp) die("Couldn't connect to the server"); + +var_dump(ftp_rawlist($ftp, 'no_exists/')); +?> +--EXPECT-- +bool(false)
\ No newline at end of file diff --git a/ext/ftp/tests/ftp_rmdir_basic.phpt b/ext/ftp/tests/ftp_rmdir_basic.phpt new file mode 100755 index 0000000000..6626cb4bed --- /dev/null +++ b/ext/ftp/tests/ftp_rmdir_basic.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing ftp_rmdir returns true +--CREDITS-- +Rodrigo Moyle <eu [at] rodrigorm [dot] com [dot] br> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$ftp = ftp_connect('127.0.0.1', $port); +if (!$ftp) die("Couldn't connect to the server"); +ftp_login($ftp, 'user', 'pass'); + +var_dump(ftp_rmdir($ftp, 'www/')); +?> +--EXPECT-- +bool(true)
\ No newline at end of file |