From: Felipe Pena Date: Sun, 17 May 2009 18:07:36 +0000 (+0000) Subject: - New tests (testfest BerlinUG) X-Git-Tag: php-5.4.0alpha1~191^2~3633 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=702a21374df885b78e920aabeccbc1dbd20f44f7;p=php - New tests (testfest BerlinUG) --- diff --git a/ext/sockets/tests/socket_accept-wrongparams.phpt b/ext/sockets/tests/socket_accept-wrongparams.phpt new file mode 100644 index 0000000000..6bce05a78b --- /dev/null +++ b/ext/sockets/tests/socket_accept-wrongparams.phpt @@ -0,0 +1,16 @@ +--TEST-- +Test parameter handling in socket_accept() +--SKIPIF-- + + resource(4) of type (Socket) + [1]=> + resource(5) of type (Socket) +} diff --git a/ext/sockets/tests/socket_listen-wrongparams.phpt b/ext/sockets/tests/socket_listen-wrongparams.phpt new file mode 100644 index 0000000000..7dd0d15921 --- /dev/null +++ b/ext/sockets/tests/socket_listen-wrongparams.phpt @@ -0,0 +1,21 @@ +--TEST-- +Test parameter handling in socket_listen(). +--SKIPIF-- + 999999 +--SKIPIF-- + +PHP Testfest Berlin 2009-05-09 diff --git a/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt b/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt new file mode 100644 index 0000000000..5b8b742f3f --- /dev/null +++ b/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test if socket_recvfrom() receives data sent by socket_sendto() via IPv6 UDP +--SKIPIF-- + +PHP Testfest Berlin 2009-05-09 diff --git a/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt b/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt new file mode 100644 index 0000000000..94eac3bdf5 --- /dev/null +++ b/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test if socket_recvfrom() receives data sent by socket_sendto() through a Unix domain socket +--SKIPIF-- + +PHP Testfest Berlin 2009-05-09 diff --git a/ext/sockets/tests/socket_set_block-retval.phpt b/ext/sockets/tests/socket_set_block-retval.phpt new file mode 100644 index 0000000000..fe09d5a5b7 --- /dev/null +++ b/ext/sockets/tests/socket_set_block-retval.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test socket_set_block return values +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +bool(true) + +Warning: socket_set_block(): %d is not a valid Socket resource in %s on line %d +bool(false) +--CREDITS-- +Robin Mehner, robin@coding-robin.de +PHP Testfest Berlin 2009-05-09 diff --git a/ext/sockets/tests/socket_set_block-wrongparams.phpt b/ext/sockets/tests/socket_set_block-wrongparams.phpt new file mode 100644 index 0000000000..7c80695525 --- /dev/null +++ b/ext/sockets/tests/socket_set_block-wrongparams.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test if socket_set_block throws E_WARNING with wrong parameters. +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: socket_set_block() expects parameter 1 to be resource, array given in %s on line %d +--CREDITS-- +Robin Mehner, robin@coding-robin.de +PHP Testfest Berlin 2009-05-09 + diff --git a/ext/sockets/tests/socket_set_nonblock-retval.phpt b/ext/sockets/tests/socket_set_nonblock-retval.phpt new file mode 100644 index 0000000000..3c4b5151a0 --- /dev/null +++ b/ext/sockets/tests/socket_set_nonblock-retval.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test socket_set_nonblock return values +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +bool(true) + +Warning: socket_set_nonblock(): %d is not a valid Socket resource in %s on line %d +bool(false) +--CREDITS-- +Robin Mehner, robin@coding-robin.de +PHP Testfest Berlin 2009-05-09 diff --git a/ext/sockets/tests/socket_set_nonblock-wrongparams.phpt b/ext/sockets/tests/socket_set_nonblock-wrongparams.phpt new file mode 100644 index 0000000000..4b7e5beb18 --- /dev/null +++ b/ext/sockets/tests/socket_set_nonblock-wrongparams.phpt @@ -0,0 +1,13 @@ +--TEST-- +Test if socket_set_nonblock throws E_WARNING with wrong parameters. +--SKIPIF-- + +--EXPECTF-- +Warning: socket_set_nonblock() expects parameter 1 to be resource, array given in %s on line %d diff --git a/ext/sockets/tests/socket_set_option_error_socket_option.phpt b/ext/sockets/tests/socket_set_option_error_socket_option.phpt new file mode 100644 index 0000000000..eaa0e64faf --- /dev/null +++ b/ext/sockets/tests/socket_set_option_error_socket_option.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test if socket_set_option() returns 'unable to set socket option' failure for invalid options +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--FILE-- + 1, "usec" => 0); +$retval_2 = socket_set_option( $socket, SOL_SOCKET, SO_RCVTIMEO, $options); +$retval_3 = socket_get_option( $socket, SOL_SOCKET, SO_RCVTIMEO); + +var_dump($retval_2); +var_dump($retval_3 === $options); +socket_close($socket); +?> + +--EXPECTF-- +Warning: socket_set_option(): no key "sec" passed in optval in %s on line %d +bool(true) +bool(true) +--CREDITS-- +Moritz Neuhaeuser, info@xcompile.net +PHP Testfest Berlin 2009-05-10 diff --git a/ext/sockets/tests/socket_set_option_seolinger.phpt b/ext/sockets/tests/socket_set_option_seolinger.phpt new file mode 100644 index 0000000000..05bc213150 --- /dev/null +++ b/ext/sockets/tests/socket_set_option_seolinger.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test if socket_set_option() works, option:SO_SEOLINGER +--DESCRIPTION--- +-wrong params +-set/get params comparison +-l_linger not given +--SKIPIF-- + +--FILE-- + 1, "l_linger" => 1); +$retval_2 = socket_set_option( $socket, SOL_SOCKET, SO_LINGER, $options); +$retval_3 = socket_get_option( $socket, SOL_SOCKET, SO_LINGER); + +//l_linger not given +$options_2 = array("l_onoff" => 1); +var_dump(socket_set_option( $socket, SOL_SOCKET, SO_LINGER, $options_2)); + +var_dump($retval_2); +var_dump($retval_3 === $options); + +socket_close($socket); +?> + +--EXPECTF-- +Warning: socket_set_option(): no key "l_onoff" passed in optval in %s on line %d + +Warning: socket_set_option(): no key "l_linger" passed in optval in %s on line %d +bool(false) +bool(true) +bool(true) +--CREDITS-- +Moritz Neuhaeuser, info@xcompile.net +PHP Testfest Berlin 2009-05-10 diff --git a/ext/sockets/tests/socket_set_option_sndtimeo.phpt b/ext/sockets/tests/socket_set_option_sndtimeo.phpt new file mode 100644 index 0000000000..c4e4851137 --- /dev/null +++ b/ext/sockets/tests/socket_set_option_sndtimeo.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test if socket_set_option() works, option:SO_SNDTIMEO +--DESCRIPTION--- +-wrong params +-set/get params comparison +--SKIPIF-- + +--FILE-- + 1, "usec" => 0); +$retval_2 = socket_set_option( $socket, SOL_SOCKET, SO_SNDTIMEO, $options); +$retval_3 = socket_get_option( $socket, SOL_SOCKET, SO_SNDTIMEO); + +var_dump($retval_2); +var_dump($retval_3 === $options); +socket_close($socket); +?> + +--EXPECTF-- +Warning: socket_set_option(): no key "sec" passed in optval in %s on line %d +bool(true) +bool(true) +--CREDITS-- +Moritz Neuhaeuser, info@xcompile.net +PHP Testfest Berlin 2009-05-10