diff options
| author | Zoe Slattery <zoe@php.net> | 2009-08-28 14:31:19 +0000 |
|---|---|---|
| committer | Zoe Slattery <zoe@php.net> | 2009-08-28 14:31:19 +0000 |
| commit | 0e4ce3bccac84196ce15f488735b7b8187978744 (patch) | |
| tree | 972c5f4e245f2a95332b20ce0fd51a79e5ec4424 | |
| parent | 9bf747605df02a95abb80ad0216a39e9059d54e1 (diff) | |
| download | php-git-0e4ce3bccac84196ce15f488735b7b8187978744.tar.gz | |
More tests from 2009 testfest
26 files changed, 525 insertions, 0 deletions
diff --git a/ext/date/tests/DatePeriod_wrong_constructor.phpt b/ext/date/tests/DatePeriod_wrong_constructor.phpt new file mode 100644 index 0000000000..62e6aa98ac --- /dev/null +++ b/ext/date/tests/DatePeriod_wrong_constructor.phpt @@ -0,0 +1,17 @@ +--TEST-- +DatePeriod: Test wrong __construct parameter +--CREDITS-- +Havard Eide <nucleuz@gmail.com> +#PHPTestFest2009 Norway 2009-06-09 \o/ +--INI-- +date.timezone=UTC +--FILE-- +<?php +new DatePeriod(); +?> +--EXPECTF-- +Fatal error: Uncaught exception 'Exception' with message 'DatePeriod::__construct(): This constructor accepts either (DateTime, DateInterval, int) OR (DateTime, DateInterval, DateTime) OR (string) as arguments.' in %s:%d +Stack trace: +#0 %s(%d): DatePeriod->__construct() +#1 {main} + thrown in %s on line %d
\ No newline at end of file diff --git a/ext/date/tests/date_timestamp_get.phpt b/ext/date/tests/date_timestamp_get.phpt new file mode 100644 index 0000000000..bdd4d047ea --- /dev/null +++ b/ext/date/tests/date_timestamp_get.phpt @@ -0,0 +1,20 @@ +--TEST-- +DateTime: Test correct setup and correct DateTime parameter to date_timestamp_get() +--CREDITS-- +Havard Eide <nucleuz@gmail.com> +#PHPTestFest2009 Norway 2009-06-09 \o/ +--INI-- +date.timezone=UTC +--FILE-- +<?php +$tz = date_timestamp_get(new DateTime()); +var_dump(is_int($tz)); +echo "\n\n"; +$tz = date_timestamp_get(time()); +?> +--EXPECTF-- +bool(true) + + + +Warning: date_timestamp_get() expects parameter 1 to be DateTime, integer given in %s on line %d
\ No newline at end of file diff --git a/ext/date/tests/timezone_identifiers_list_wrong_constructor.phpt b/ext/date/tests/timezone_identifiers_list_wrong_constructor.phpt new file mode 100644 index 0000000000..5b8493ba11 --- /dev/null +++ b/ext/date/tests/timezone_identifiers_list_wrong_constructor.phpt @@ -0,0 +1,15 @@ +--TEST-- +timezone_identifiers_list: Test that correct notice is given when timezone_identifiers_list is given 4096 as parameter +--CREDITS-- +Havard Eide <nucleuz@gmail.com> +#PHPTestFest2009 Norway 2009-06-09 \o/ +--INI-- +error_reporting=E_ALL +date.timezone=UTC +--FILE-- +<?php +print_r(timezone_identifiers_list(4096)); + +?> +--EXPECTF-- +Notice: timezone_identifiers_list(): A two-letter ISO 3166-1 compatible country code is expected in %s on line %d
\ No newline at end of file diff --git a/ext/date/tests/timezone_location_get.phpt b/ext/date/tests/timezone_location_get.phpt new file mode 100644 index 0000000000..745fc8799e --- /dev/null +++ b/ext/date/tests/timezone_location_get.phpt @@ -0,0 +1,24 @@ +--TEST-- +timezone_location_get: Test that timezone_location_get returns a correct array of information +--CREDITS-- +Havard Eide <nucleuz@gmail.com> +#PHPTestFest2009 Norway 2009-06-09 \o/ +--INI-- +date.timezone=UTC +--FILE-- +<?php +$location = timezone_location_get(new DateTimeZone("Europe/Oslo")); +var_dump($location); +?> +--EXPECT-- +array(4) { + ["country_code"]=> + string(2) "NO" + ["latitude"]=> + float(59.91666) + ["longitude"]=> + float(10.75) + ["comments"]=> + string(0) "" +} + diff --git a/ext/gd/tests/imageellipse_error8.phpt b/ext/gd/tests/imageellipse_error8.phpt new file mode 100755 index 0000000000..3fefb56bde --- /dev/null +++ b/ext/gd/tests/imageellipse_error8.phpt @@ -0,0 +1,21 @@ +--TEST--
+Testing wrong param passing imageellipse() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-20
+--SKIPIF--
+<?php
+if ( ! extension_loaded("gd") ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+
+// Create a image
+$image = imagecreatetruecolor( 400, 300 );
+
+// try to draw a white ellipse
+imageellipse( $image, 200, 150, 300, 200 );
+
+?>
+--EXPECTF--
+Warning: imageellipse() expects exactly 6 parameters, %d given in %s on line %d diff --git a/ext/gd/tests/imagefilltoborder_error7.phpt b/ext/gd/tests/imagefilltoborder_error7.phpt new file mode 100755 index 0000000000..aeb7d82620 --- /dev/null +++ b/ext/gd/tests/imagefilltoborder_error7.phpt @@ -0,0 +1,26 @@ +--TEST--
+Testing wrong param passing imagefilltoborder() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded("gd")) die("skip GD not present; skipping test");
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
+
+// Draw an ellipse to fill with a black border
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
+
+// Try to fill border
+imagefilltoborder( $image, 50, 50 );
+
+?>
+--EXPECTF--
+Warning: imagefilltoborder() expects exactly 5 parameters, %d given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error1.phpt b/ext/gd/tests/imagerectangle_error1.phpt new file mode 100755 index 0000000000..2b4235e854 --- /dev/null +++ b/ext/gd/tests/imagerectangle_error1.phpt @@ -0,0 +1,19 @@ +--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( 'wrong param', 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
+Warning: imagerectangle() expects parameter 1 to be resource, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error3.phpt b/ext/gd/tests/imagerectangle_error3.phpt new file mode 100755 index 0000000000..d5dd4c1d80 --- /dev/null +++ b/ext/gd/tests/imagerectangle_error3.phpt @@ -0,0 +1,19 @@ +--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 'wrong param', 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
+Warning: imagerectangle() expects parameter 2 to be long, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error4.phpt b/ext/gd/tests/imagerectangle_error4.phpt new file mode 100755 index 0000000000..7ecc4167a8 --- /dev/null +++ b/ext/gd/tests/imagerectangle_error4.phpt @@ -0,0 +1,19 @@ +--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 'wrong param', 50, 50, imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
+Warning: imagerectangle() expects parameter 3 to be long, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error5.phpt b/ext/gd/tests/imagerectangle_error5.phpt new file mode 100755 index 0000000000..b4288d270c --- /dev/null +++ b/ext/gd/tests/imagerectangle_error5.phpt @@ -0,0 +1,19 @@ +--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 'wrong param', 50, imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
+Warning: imagerectangle() expects parameter 4 to be long, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error6.phpt b/ext/gd/tests/imagerectangle_error6.phpt new file mode 100755 index 0000000000..aab378e557 --- /dev/null +++ b/ext/gd/tests/imagerectangle_error6.phpt @@ -0,0 +1,19 @@ +--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 'wrong param', imagecolorallocate($image, 255, 255, 255) );
+?>
+--EXPECTF--
+Warning: imagerectangle() expects parameter 5 to be long, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error7.phpt b/ext/gd/tests/imagerectangle_error7.phpt new file mode 100755 index 0000000000..f6ed778db7 --- /dev/null +++ b/ext/gd/tests/imagerectangle_error7.phpt @@ -0,0 +1,19 @@ +--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 50, 'wrong param' );
+?>
+--EXPECTF--
+Warning: imagerectangle() expects parameter 6 to be long, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error8.phpt b/ext/gd/tests/imagerectangle_error8.phpt new file mode 100755 index 0000000000..361de69cde --- /dev/null +++ b/ext/gd/tests/imagerectangle_error8.phpt @@ -0,0 +1,19 @@ +--TEST--
+Testing wrong param passing imagerectangle() of GD library
+--CREDITS--
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>
+#testfest PHPSP on 2009-06-30
+--SKIPIF--
+<?php
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
+?>
+--FILE--
+<?php
+// Create a image
+$image = imagecreatetruecolor( 100, 100 );
+
+// Draw a rectangle
+imagerectangle( $image, 0, 0, 50, 50 );
+?>
+--EXPECTF--
+Warning: imagerectangle() expects exactly 6 parameters, %d given in %s on line %d diff --git a/ext/posix/tests/posix_ctermid_error.phpt b/ext/posix/tests/posix_ctermid_error.phpt new file mode 100644 index 0000000000..a177f54578 --- /dev/null +++ b/ext/posix/tests/posix_ctermid_error.phpt @@ -0,0 +1,19 @@ +--TEST-- +Test function posix_ctermid() by calling it more than or less than its expected arguments +--SKIPIF-- +<?php + if(!extension_loaded("posix")) print "skip - POSIX extension not loaded"; +?> +--CREDITS-- +Marco Fabbri mrfabbri@gmail.com +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--FILE-- +<?php + +var_dump( posix_ctermid( 'foo' ) ); + +?> +--EXPECTF-- +Warning: posix_ctermid() expects exactly 0 parameters, 1 given in %s on line %d +NULL diff --git a/ext/posix/tests/posix_errno_error.phpt b/ext/posix/tests/posix_errno_error.phpt new file mode 100644 index 0000000000..0a77fb0009 --- /dev/null +++ b/ext/posix/tests/posix_errno_error.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test function posix_errno() by calling it with its expected arguments +--SKIPIF-- +<?php + if(!extension_loaded("posix")) print "skip - POSIX extension not loaded"; +?> +--CREDITS-- +Morten Amundsen mor10am@gmail.com +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--FILE-- +<?php + +echo "*** Test by calling method or function with more than expected arguments ***\n"; + +// test without any error +var_dump(posix_errno('bar')); + +?> +--EXPECTF-- +*** Test by calling method or function with more than expected arguments *** + +Warning: posix_errno() expects exactly 0 parameters, 1 given in %s on line %d +NULL diff --git a/ext/posix/tests/posix_geteuid_error1.phpt b/ext/posix/tests/posix_geteuid_error1.phpt new file mode 100644 index 0000000000..ac4e0d5ddc --- /dev/null +++ b/ext/posix/tests/posix_geteuid_error1.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test function posix_geteuid() by calling it more than or less than its expected arguments +--SKIPIF-- +<?php + if(!extension_loaded("posix")) print "skip - POSIX extension not loaded"; +?> +--CREDITS-- +Marco Fabbri mrfabbri@gmail.com +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--FILE-- +<?php +echo "*** Test by calling method or function with incorrect numbers of arguments ***\n"; + +$extra_args = array( 12312, 2 => '1234', 'string' => 'string' ); + +var_dump( posix_geteuid( $extra_args )); +foreach ( $extra_args as $arg ) +{ + var_dump(posix_geteuid( $arg )); +} + +?> +--EXPECTF-- +*** Test by calling method or function with incorrect numbers of arguments *** + +Warning: posix_geteuid() expects exactly 0 parameters, 1 given in %s on line %d +NULL + +Warning: posix_geteuid() expects exactly 0 parameters, 1 given in %s on line %d +NULL + +Warning: posix_geteuid() expects exactly 0 parameters, 1 given in %s on line %d +NULL + +Warning: posix_geteuid() expects exactly 0 parameters, 1 given in %s on line %d +NULL diff --git a/ext/spl/tests/splDoublyLinkedList_shift_noParams.phpt b/ext/spl/tests/splDoublyLinkedList_shift_noParams.phpt new file mode 100644 index 0000000000..cd4ea5b033 --- /dev/null +++ b/ext/spl/tests/splDoublyLinkedList_shift_noParams.phpt @@ -0,0 +1,15 @@ +--TEST-- +Checks that the shift() method of DoublyLinkedList does not accept args. +--CREDITS-- +PHPNW Test Fest 2009 - Rick Ogden +--FILE-- +<?php +$ll = new SplDoublyLinkedList(); +$ll->push(1); +$ll->push(2); + +var_dump($ll->shift(1)); +?> +--EXPECTF-- +Warning: SplDoublyLinkedList::shift() expects exactly 0 parameters, 1 given in %s on line %d +NULL diff --git a/ext/spl/tests/spldoublylinkedlist_offsetunset_first.phpt b/ext/spl/tests/spldoublylinkedlist_offsetunset_first.phpt new file mode 100644 index 0000000000..4dce4db8de --- /dev/null +++ b/ext/spl/tests/spldoublylinkedlist_offsetunset_first.phpt @@ -0,0 +1,25 @@ +--TEST-- +SPL: SplDoublyLinkedList : offsetUnset - first element +--CREDITS-- +PHPNW TestFest2009 - Rowan Merewood <rowan@merewood.org> +--FILE-- +<?php +$list = new SplDoublyLinkedList(); +$list->push('oh'); +$list->push('hai'); +$list->push('thar'); +$list->offsetUnset(0); +var_dump($list); +?> +--EXPECTF-- +object(SplDoublyLinkedList)#1 (2) { + [%u|b%"flags":%u|b%"SplDoublyLinkedList":private]=> + int(0) + [%u|b%"dllist":%u|b%"SplDoublyLinkedList":private]=> + array(2) { + [0]=> + %string|unicode%(3) "hai" + [1]=> + %string|unicode%(4) "thar" + } +} diff --git a/ext/spl/tests/spldoublylinkedlist_offsetunset_first002.phpt b/ext/spl/tests/spldoublylinkedlist_offsetunset_first002.phpt new file mode 100644 index 0000000000..a42e6f9040 --- /dev/null +++ b/ext/spl/tests/spldoublylinkedlist_offsetunset_first002.phpt @@ -0,0 +1,17 @@ +--TEST-- +SPL: SplDoublyLinkedList : offsetUnset - first element +--CREDITS-- +PHPNW TestFest2009 - Rowan Merewood <rowan@merewood.org> +--FILE-- +<?php +$list = new SplDoublyLinkedList(); +$list->push('oh'); +$list->push('hai'); +$list->push('thar'); +echo $list->bottom() . "\n"; +$list->offsetUnset(0); +echo $list->bottom() . "\n"; +?> +--EXPECT-- +oh +hai diff --git a/ext/spl/tests/spldoublylinkedlist_offsetunset_last.phpt b/ext/spl/tests/spldoublylinkedlist_offsetunset_last.phpt new file mode 100644 index 0000000000..0f5dac19f9 --- /dev/null +++ b/ext/spl/tests/spldoublylinkedlist_offsetunset_last.phpt @@ -0,0 +1,25 @@ +--TEST-- +SPL: SplDoublyLinkedList : offsetUnset - last element +--CREDITS-- +PHPNW TestFest2009 - Rowan Merewood <rowan@merewood.org> +--FILE-- +<?php +$list = new SplDoublyLinkedList(); +$list->push('oh'); +$list->push('hai'); +$list->push('thar'); +$list->offsetUnset(2); +var_dump($list); +?> +--EXPECTF-- +object(SplDoublyLinkedList)#1 (2) { + [%u|b%"flags":%u|b%"SplDoublyLinkedList":private]=> + int(0) + [%u|b%"dllist":%u|b%"SplDoublyLinkedList":private]=> + array(2) { + [0]=> + %string|unicode%(2) "oh" + [1]=> + %string|unicode%(3) "hai" + } +} diff --git a/ext/spl/tests/splfixedarray_offsetExists_larger.phpt b/ext/spl/tests/splfixedarray_offsetExists_larger.phpt new file mode 100644 index 0000000000..9449d64d8d --- /dev/null +++ b/ext/spl/tests/splfixedarray_offsetExists_larger.phpt @@ -0,0 +1,15 @@ +--TEST-- +Checks that offsetExists() does not accept a value larger than the array. +--CREDITS-- + PHPNW Test Fest 2009 - Rick Ogden +--FILE-- +<?php +$ar = new SplFixedArray(3); +$ar[0] = 1; +$ar[1] = 2; +$ar[2] = 3; + +var_dump($ar->offsetExists(4)); +?> +--EXPECT-- +bool(false) diff --git a/ext/standard/tests/array/key_exists_error.phpt b/ext/standard/tests/array/key_exists_error.phpt new file mode 100644 index 0000000000..1bbd41e20e --- /dev/null +++ b/ext/standard/tests/array/key_exists_error.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test function key_exists() by calling it more than or less than its expected arguments +--CREDITS-- +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--FILE-- +<?php + +echo "*** Test by calling method or function with incorrect numbers of arguments ***\n"; + +$a = array('bar' => 1); +var_dump(key_exists()); +var_dump(key_exists('foo', $a, 'baz')); + +?> +--EXPECTF-- +*** Test by calling method or function with incorrect numbers of arguments *** + +Warning: key_exists() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: key_exists() expects exactly 2 parameters, 3 given in %s on line %d +NULL diff --git a/ext/standard/tests/general_functions/.getservbyport_basic.phpt.swp b/ext/standard/tests/general_functions/.getservbyport_basic.phpt.swp Binary files differnew file mode 100644 index 0000000000..dc8000aa0f --- /dev/null +++ b/ext/standard/tests/general_functions/.getservbyport_basic.phpt.swp diff --git a/ext/standard/tests/general_functions/get_cfg_var_error.phpt b/ext/standard/tests/general_functions/get_cfg_var_error.phpt new file mode 100644 index 0000000000..1c319bf790 --- /dev/null +++ b/ext/standard/tests/general_functions/get_cfg_var_error.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test function get_cfg_var() by calling it more than or less than its expected arguments +--CREDITS-- +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--INI-- +session.use_cookies=0 +session.serialize_handler=php +session.save_handler=files +--FILE-- +<?php + +echo "*** Test by calling method or function with incorrect numbers of arguments ***\n"; + +var_dump(get_cfg_var( 'session.use_cookies', 'session.serialize_handler' ) ); +var_dump(get_cfg_var( ) ); + + +?> +--EXPECTF-- +*** Test by calling method or function with incorrect numbers of arguments *** + +Warning: get_cfg_var() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: get_cfg_var() expects exactly 1 parameter, 0 given in %s on line %d +NULL diff --git a/ext/standard/tests/general_functions/getservbyname_error.phpt b/ext/standard/tests/general_functions/getservbyname_error.phpt new file mode 100755 index 0000000000..eaeec64888 --- /dev/null +++ b/ext/standard/tests/general_functions/getservbyname_error.phpt @@ -0,0 +1,21 @@ +--TEST-- +Test function getservbyname() by calling it more than or less than its expected arguments +--CREDITS-- +Italian PHP TestFest 2009 Cesena 19-20-21 june +Fabio Fabbrucci (fabbrucci@grupporetina.com) +Michele Orselli (mo@ideato.it) +Danilo Sanchi (sanchi@grupporetina.com) +--FILE-- +<?php +$service = "www"; +$protocol = "tcp"; +$extra_arg = 12; +var_dump(getservbyname($service, $protocol, $extra_arg ) ); +var_dump(getservbyname($service)); +?> +--EXPECTF-- +Warning: getservbyname() expects exactly 2 parameters, %d given in %s on line %d +NULL + +Warning: getservbyname() expects exactly 2 parameters, %d given in %s on line %d +NULL diff --git a/ext/standard/tests/general_functions/getservbyport_error.phpt b/ext/standard/tests/general_functions/getservbyport_error.phpt new file mode 100644 index 0000000000..e2c245b7ea --- /dev/null +++ b/ext/standard/tests/general_functions/getservbyport_error.phpt @@ -0,0 +1,21 @@ +--TEST-- +Test function getservbyport() by calling it more than or less than its expected arguments +--CREDITS-- +Italian PHP TestFest 2009 Cesena 19-20-21 june +Fabio Fabbrucci (fabbrucci@grupporetina.com) +Michele Orselli (mo@ideato.it) +Simone Gentili (sensorario@gmail.com) +--FILE-- +<?php +$port = 80; +$protocol = "tcp"; +$extra_arg = 12; +var_dump(getservbyport( $port, $protocol, $extra_arg ) ); +var_dump(getservbyport($port)); +?> +--EXPECTF-- +Warning: getservbyport() expects exactly 2 parameters, %d given in %s on line %d +NULL + +Warning: getservbyport() expects exactly 2 parameters, %d given in %s on line %d +NULL |
