]> granicus.if.org Git - php/commitdiff
More tests from 2009 testfest
authorZoe Slattery <zoe@php.net>
Fri, 28 Aug 2009 14:31:19 +0000 (14:31 +0000)
committerZoe Slattery <zoe@php.net>
Fri, 28 Aug 2009 14:31:19 +0000 (14:31 +0000)
25 files changed:
ext/date/tests/DatePeriod_wrong_constructor.phpt [new file with mode: 0644]
ext/date/tests/date_timestamp_get.phpt [new file with mode: 0644]
ext/date/tests/timezone_identifiers_list_wrong_constructor.phpt [new file with mode: 0644]
ext/date/tests/timezone_location_get.phpt [new file with mode: 0644]
ext/gd/tests/imageellipse_error8.phpt [new file with mode: 0755]
ext/gd/tests/imagefilltoborder_error7.phpt [new file with mode: 0755]
ext/gd/tests/imagerectangle_error1.phpt [new file with mode: 0755]
ext/gd/tests/imagerectangle_error3.phpt [new file with mode: 0755]
ext/gd/tests/imagerectangle_error4.phpt [new file with mode: 0755]
ext/gd/tests/imagerectangle_error5.phpt [new file with mode: 0755]
ext/gd/tests/imagerectangle_error6.phpt [new file with mode: 0755]
ext/gd/tests/imagerectangle_error7.phpt [new file with mode: 0755]
ext/gd/tests/imagerectangle_error8.phpt [new file with mode: 0755]
ext/posix/tests/posix_ctermid_error.phpt [new file with mode: 0644]
ext/posix/tests/posix_errno_error.phpt [new file with mode: 0644]
ext/posix/tests/posix_geteuid_error1.phpt [new file with mode: 0644]
ext/spl/tests/splDoublyLinkedList_shift_noParams.phpt [new file with mode: 0644]
ext/spl/tests/spldoublylinkedlist_offsetunset_first.phpt [new file with mode: 0644]
ext/spl/tests/spldoublylinkedlist_offsetunset_first002.phpt [new file with mode: 0644]
ext/spl/tests/spldoublylinkedlist_offsetunset_last.phpt [new file with mode: 0644]
ext/spl/tests/splfixedarray_offsetExists_larger.phpt [new file with mode: 0644]
ext/standard/tests/array/key_exists_error.phpt [new file with mode: 0644]
ext/standard/tests/general_functions/get_cfg_var_error.phpt [new file with mode: 0644]
ext/standard/tests/general_functions/getservbyname_error.phpt [new file with mode: 0755]
ext/standard/tests/general_functions/getservbyport_error.phpt [new file with mode: 0644]

diff --git a/ext/date/tests/DatePeriod_wrong_constructor.phpt b/ext/date/tests/DatePeriod_wrong_constructor.phpt
new file mode 100644 (file)
index 0000000..62e6aa9
--- /dev/null
@@ -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 (file)
index 0000000..bdd4d04
--- /dev/null
@@ -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 (file)
index 0000000..5b8493b
--- /dev/null
@@ -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 (file)
index 0000000..745fc87
--- /dev/null
@@ -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 (executable)
index 0000000..3fefb56
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--\r
+Testing wrong param passing imageellipse() of GD library\r
+--CREDITS--\r
+Ivan Rosolen <contato [at] ivanrosolen [dot] com>\r
+#testfest PHPSP on 2009-06-20\r
+--SKIPIF--\r
+<?php \r
+if ( ! extension_loaded("gd") ) die( 'skip GD not present; skipping test' );\r
+?>\r
+--FILE--\r
+<?php\r
+\r
+// Create a image\r
+$image = imagecreatetruecolor( 400, 300 );\r
+\r
+// try to draw a white ellipse\r
+imageellipse( $image, 200, 150, 300, 200 );\r
+\r
+?>\r
+--EXPECTF--\r
+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 (executable)
index 0000000..aeb7d82
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST-- \r
+Testing wrong param passing imagefilltoborder() of GD library \r
+--CREDITS-- \r
+Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
+#testfest PHPSP on 2009-06-30\r
+--SKIPIF-- \r
+<?php  \r
+if ( ! extension_loaded("gd")) die("skip GD not present; skipping test"); \r
+?> \r
+--FILE--\r
+<?php\r
+// Create a image \r
+$image = imagecreatetruecolor( 100, 100 ); \r
+\r
+// Draw a rectangle\r
+imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );\r
+\r
+// Draw an ellipse to fill with a black border\r
+imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );\r
+\r
+// Try to fill border\r
+imagefilltoborder( $image, 50, 50 );\r
+\r
+?> \r
+--EXPECTF--\r
+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 (executable)
index 0000000..2b4235e
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST-- \r
+Testing wrong param passing imagerectangle() of GD library \r
+--CREDITS-- \r
+Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
+#testfest PHPSP on 2009-06-30\r
+--SKIPIF-- \r
+<?php  \r
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); \r
+?> \r
+--FILE--\r
+<?php\r
+// Create a image \r
+$image = imagecreatetruecolor( 100, 100 ); \r
+\r
+// Draw a rectangle\r
+imagerectangle( 'wrong param', 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );\r
+?> \r
+--EXPECTF--\r
+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 (executable)
index 0000000..d5dd4c1
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST-- \r
+Testing wrong param passing imagerectangle() of GD library \r
+--CREDITS-- \r
+Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
+#testfest PHPSP on 2009-06-30\r
+--SKIPIF-- \r
+<?php  \r
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); \r
+?> \r
+--FILE--\r
+<?php\r
+// Create a image \r
+$image = imagecreatetruecolor( 100, 100 ); \r
+\r
+// Draw a rectangle\r
+imagerectangle( $image, 'wrong param', 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );\r
+?> \r
+--EXPECTF--\r
+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 (executable)
index 0000000..7ecc416
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST-- \r
+Testing wrong param passing imagerectangle() of GD library \r
+--CREDITS-- \r
+Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
+#testfest PHPSP on 2009-06-30\r
+--SKIPIF-- \r
+<?php  \r
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); \r
+?> \r
+--FILE--\r
+<?php\r
+// Create a image \r
+$image = imagecreatetruecolor( 100, 100 ); \r
+\r
+// Draw a rectangle\r
+imagerectangle( $image, 0, 'wrong param', 50, 50, imagecolorallocate($image, 255, 255, 255) );\r
+?> \r
+--EXPECTF--\r
+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 (executable)
index 0000000..b4288d2
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST-- \r
+Testing wrong param passing imagerectangle() of GD library \r
+--CREDITS-- \r
+Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
+#testfest PHPSP on 2009-06-30\r
+--SKIPIF-- \r
+<?php  \r
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); \r
+?> \r
+--FILE--\r
+<?php\r
+// Create a image \r
+$image = imagecreatetruecolor( 100, 100 ); \r
+\r
+// Draw a rectangle\r
+imagerectangle( $image, 0, 0, 'wrong param', 50, imagecolorallocate($image, 255, 255, 255) );\r
+?> \r
+--EXPECTF--\r
+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 (executable)
index 0000000..aab378e
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST-- \r
+Testing wrong param passing imagerectangle() of GD library \r
+--CREDITS-- \r
+Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
+#testfest PHPSP on 2009-06-30\r
+--SKIPIF-- \r
+<?php  \r
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); \r
+?> \r
+--FILE--\r
+<?php\r
+// Create a image \r
+$image = imagecreatetruecolor( 100, 100 ); \r
+\r
+// Draw a rectangle\r
+imagerectangle( $image, 0, 0, 50, 'wrong param', imagecolorallocate($image, 255, 255, 255) );\r
+?> \r
+--EXPECTF--\r
+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 (executable)
index 0000000..f6ed778
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST-- \r
+Testing wrong param passing imagerectangle() of GD library \r
+--CREDITS-- \r
+Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
+#testfest PHPSP on 2009-06-30\r
+--SKIPIF-- \r
+<?php  \r
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); \r
+?> \r
+--FILE--\r
+<?php\r
+// Create a image \r
+$image = imagecreatetruecolor( 100, 100 ); \r
+\r
+// Draw a rectangle\r
+imagerectangle( $image, 0, 0, 50, 50, 'wrong param' );\r
+?> \r
+--EXPECTF--\r
+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 (executable)
index 0000000..361de69
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST-- \r
+Testing wrong param passing imagerectangle() of GD library \r
+--CREDITS-- \r
+Ivan Rosolen <contato [at] ivanrosolen [dot] com> \r
+#testfest PHPSP on 2009-06-30\r
+--SKIPIF-- \r
+<?php  \r
+if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); \r
+?> \r
+--FILE--\r
+<?php\r
+// Create a image \r
+$image = imagecreatetruecolor( 100, 100 ); \r
+\r
+// Draw a rectangle\r
+imagerectangle( $image, 0, 0, 50, 50 );\r
+?> \r
+--EXPECTF--\r
+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 (file)
index 0000000..a177f54
--- /dev/null
@@ -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 (file)
index 0000000..0a77fb0
--- /dev/null
@@ -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 (file)
index 0000000..ac4e0d5
--- /dev/null
@@ -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 (file)
index 0000000..cd4ea5b
--- /dev/null
@@ -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 (file)
index 0000000..4dce4db
--- /dev/null
@@ -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 (file)
index 0000000..a42e6f9
--- /dev/null
@@ -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 (file)
index 0000000..0f5dac1
--- /dev/null
@@ -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 (file)
index 0000000..9449d64
--- /dev/null
@@ -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 (file)
index 0000000..1bbd41e
--- /dev/null
@@ -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/get_cfg_var_error.phpt b/ext/standard/tests/general_functions/get_cfg_var_error.phpt
new file mode 100644 (file)
index 0000000..1c319bf
--- /dev/null
@@ -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 (executable)
index 0000000..eaeec64
--- /dev/null
@@ -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 (file)
index 0000000..e2c245b
--- /dev/null
@@ -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