zoe Sun, 30 Aug 2009 12:19:50 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=287896
Log:
More tests from 2009 testfest
Changed paths:
A
php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt
A
php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt
A
php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
A
php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation1.phpt
A
php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation13.phpt
A
php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation6.phpt
A
php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation8.phpt
A
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt
A
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt
A
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
A
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation1.phpt
A
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation13.phpt
A
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation6.phpt
A
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation8.phpt
A
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyport_variation1.phpt
A
php/php-src/trunk/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt
A
php/php-src/trunk/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt
A
php/php-src/trunk/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
A
php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation1.phpt
A
php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation13.phpt
A
php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation6.phpt
A
php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation8.phpt
A
php/php-src/trunk/ext/standard/tests/general_functions/getservbyport_variation1.phpt
Added: php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,46 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with array values.
+--CREDITS--
+Francesco Fullone [email protected]
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with array values ***\n";
+
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with array values ***
+
+Notice: Array to string conversion in %s.php on line %d
+bool(false)
+
+Notice: Array to string conversion in %s.php on line %d
+bool(false)
+
+Notice: Array to string conversion in %s.php on line %d
+bool(false)
+
+Notice: Array to string conversion in %s.php on line %d
+bool(false)
Added: php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,41 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with object values.
+--CREDITS--
+Francesco Fullone [email protected]
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with object values ***\n";
+
+class classWithToString
+{
+ public function __toString() {
+ return "session.use_cookies";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with object values ***
+string(1) "0"
+
+Catchable fatal error: Object of class classWithoutToString could not be converted to string in %s.php on line %d
Added: php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,20 @@
+--TEST--
+Test function get_cfg_var() by calling deprecated option
+--CREDITS--
+Francesco Fullone [email protected]
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+register_globals=1
+--SKIPIF--
+<?php if (version_compare(PHP_VERSION, "5.3", "<")) die("skip requires 5.3 or greater"); ?>
+--FILE--
+<?php
+echo "*** Test by calling method or function with deprecated option ***\n";
+var_dump(get_cfg_var( 'register_globals' ) );
+
+?>
+--EXPECTF--
+PHP Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in %s on line 0
+*** Test by calling method or function with deprecated option ***
+string(1) "1"
+
Added: php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation1.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation1.phpt (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation1.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,40 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with array values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with array values ***\n";
+
+$protocol = "tcp";
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with array values ***
+
+Notice: Array to string conversion in %s.php on line %d
+bool(false)
+
+Notice: Array to string conversion in %s.php on line %d
+bool(false)
+
+Notice: Array to string conversion in %s.php on line %d
+bool(false)
+
+Notice: Array to string conversion in %s.php on line %d
+bool(false)
Property changes on: php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation1.phpt
___________________________________________________________________
Added: svn:executable
+ *
Added: php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation13.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation13.phpt (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation13.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,37 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with object values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with object values ***\n";
+
+$service = "www";
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with object values ***
+bool(false)
+
+Catchable fatal error: Object of class classWithoutToString could not be converted to string in %s.php on line %d
Property changes on: php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation13.phpt
___________________________________________________________________
Added: svn:executable
+ *
Added: php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation6.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation6.phpt (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation6.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,37 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with object values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with object values ***\n";
+
+$protocol = "tcp";
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with object values ***
+bool(false)
+
+Catchable fatal error: Object of class classWithoutToString could not be converted to string in %s.php on line %d
Property changes on: php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation6.phpt
___________________________________________________________________
Added: svn:executable
+ *
Added: php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation8.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation8.phpt (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation8.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,40 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with array values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with array values ***\n";
+
+$service = "www";
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with array values ***
+
+Notice: Array to string conversion in %s.php on line %d
+bool(false)
+
+Notice: Array to string conversion in %s.php on line %d
+bool(false)
+
+Notice: Array to string conversion in %s.php on line %d
+bool(false)
+
+Notice: Array to string conversion in %s.php on line %d
+bool(false)
Property changes on: php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/getservbyname_variation8.phpt
___________________________________________________________________
Added: svn:executable
+ *
Added: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,46 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with array values.
+--CREDITS--
+Francesco Fullone [email protected]
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with array values ***\n";
+
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with array values ***
+
+Warning: get_cfg_var() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: get_cfg_var() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: get_cfg_var() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: get_cfg_var() expects parameter 1 to be string, array given in %s on line %d
+NULL
Added: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,44 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with object values.
+--CREDITS--
+Francesco Fullone [email protected]
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with object values ***\n";
+
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "session.use_cookies";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with object values ***
+string(1) "0"
+
+Warning: get_cfg_var() expects parameter 1 to be string, object given in %s.php on line %d
+NULL
Added: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,20 @@
+--TEST--
+Test function get_cfg_var() by calling deprecated option
+--CREDITS--
+Francesco Fullone [email protected]
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+register_globals=1
+--SKIPIF--
+<?php if (version_compare(PHP_VERSION, "5.3", "<")) die("skip requires 5.3 or greater"); ?>
+--FILE--
+<?php
+echo "*** Test by calling method or function with deprecated option ***\n";
+var_dump(get_cfg_var( 'register_globals' ) );
+
+?>
+--EXPECTF--
+PHP Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in %s on line 0
+*** Test by calling method or function with deprecated option ***
+string(1) "1"
+
Added: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation1.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation1.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation1.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,40 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with array values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with array values ***\n";
+
+$protocol = "tcp";
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with array values ***
+
+Warning: getservbyname() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 1 to be string, array given in %s on line %d
+NULL
Property changes on: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation1.phpt
___________________________________________________________________
Added: svn:executable
+ *
Added: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation13.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation13.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation13.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,38 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with object values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with object values ***\n";
+
+$service = "www";
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with object values ***
+bool(false)
+
+Warning: getservbyname() expects parameter 2 to be string, object given in %s.php on line %d
+NULL
Property changes on: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation13.phpt
___________________________________________________________________
Added: svn:executable
+ *
Added: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation6.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation6.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation6.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,38 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with object values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with object values ***\n";
+
+$protocol = "tcp";
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with object values ***
+bool(false)
+
+Warning: getservbyname() expects parameter 1 to be string, object given in %s.php on line %d
+NULL
Property changes on: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation6.phpt
___________________________________________________________________
Added: svn:executable
+ *
Added: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation8.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation8.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation8.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,40 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with array values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with array values ***\n";
+
+$service = "www";
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with array values ***
+
+Warning: getservbyname() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 2 to be string, array given in %s on line %d
+NULL
Property changes on: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyname_variation8.phpt
___________________________________________________________________
Added: svn:executable
+ *
Added: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyport_variation1.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyport_variation1.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/getservbyport_variation1.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,40 @@
+--TEST--
+Test function getservbyport() by calling it more than or less than its expected arguments
+--DESCRIPTION--
+Test function passing invalid port number and invalid protocol name
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci ([email protected])
+Michele Orselli ([email protected])
+Simone Gentili ([email protected])
+--FILE--
+<?php
+ var_dump(getservbyport( -1, "tcp" ));
+ var_dump(getservbyport( 80, "ppp" ));
+ var_dump(getservbyport( null, null));
+ var_dump(getservbyport( array(), array()));
+ var_dump(getservbyport( array(80), array("tcp")));
+ var_dump(getservbyport( array(2, 3), array("one"=>1, "two"=>2)));
+ var_dump(getservbyport( 2, 2));
+ var_dump(getservbyport( "80", "tcp"));
+ var_dump(getservbyport( new stdClass(), new stdClass()));
+
+?>
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+
+Warning: getservbyport() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+Warning: getservbyport() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+Warning: getservbyport() expects parameter 1 to be long, array given in %s on line %d
+NULL
+bool(false)
+string(%d) "%s"
+
+Warning: getservbyport() expects parameter 1 to be long, object given in %s on line %d
+NULL
Added: php/php-src/trunk/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt
===================================================================
--- php/php-src/trunk/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt (rev 0)
+++ php/php-src/trunk/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,46 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with array values.
+--CREDITS--
+Francesco Fullone [email protected]
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with array values ***\n";
+
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with array values ***
+
+Warning: get_cfg_var() expects parameter 1 to be binary string, array given in %s on line %d
+NULL
+
+Warning: get_cfg_var() expects parameter 1 to be binary string, array given in %s on line %d
+NULL
+
+Warning: get_cfg_var() expects parameter 1 to be binary string, array given in %s on line %d
+NULL
+
+Warning: get_cfg_var() expects parameter 1 to be binary string, array given in %s on line %d
+NULL
Added: php/php-src/trunk/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt
===================================================================
--- php/php-src/trunk/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt (rev 0)
+++ php/php-src/trunk/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,44 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with object values.
+--CREDITS--
+Francesco Fullone [email protected]
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with object values ***\n";
+
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "session.use_cookies";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with object values ***
+unicode(1) "0"
+
+Warning: get_cfg_var() expects parameter 1 to be binary string, object given in %s.php on line %d
+NULL
Added: php/php-src/trunk/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
===================================================================
--- php/php-src/trunk/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt (rev 0)
+++ php/php-src/trunk/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,19 @@
+--TEST--
+Test function get_cfg_var() by calling deprecated option
+--CREDITS--
+Francesco Fullone [email protected]
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+register_globals=1
+--SKIPIF--
+<?php if (version_compare(PHP_VERSION, "5.3", "<")) die("skip requires 5.3 or greater"); ?>
+--FILE--
+<?php
+echo "*** Test by calling method or function with deprecated option ***\n";
+var_dump(get_cfg_var( 'register_globals' ) );
+
+?>
+--EXPECTF--
+PHP Warning: Directive 'register_globals' is no longer supported in PHP 6 and greater in Unknown on line 0
+*** Test by calling method or function with deprecated option ***
+unicode(1) "1"
Added: php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation1.phpt
===================================================================
--- php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation1.phpt (rev 0)
+++ php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation1.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,40 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with array values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with array values ***\n";
+
+$protocol = "tcp";
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with array values ***
+
+Warning: getservbyname() expects parameter 1 to be binary string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 1 to be binary string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 1 to be binary string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 1 to be binary string, array given in %s on line %d
+NULL
Property changes on: php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation1.phpt
___________________________________________________________________
Added: svn:executable
+ *
Added: php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation13.phpt
===================================================================
--- php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation13.phpt (rev 0)
+++ php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation13.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,38 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with object values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with object values ***\n";
+
+$service = "www";
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with object values ***
+bool(false)
+
+Warning: getservbyname() expects parameter 2 to be binary string, object given in %s.php on line %d
+NULL
Property changes on: php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation13.phpt
___________________________________________________________________
Added: svn:executable
+ *
Added: php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation6.phpt
===================================================================
--- php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation6.phpt (rev 0)
+++ php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation6.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,38 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with object values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with object values ***\n";
+
+$protocol = "tcp";
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with object values ***
+bool(false)
+
+Warning: getservbyname() expects parameter 1 to be binary string, object given in %s.php on line %d
+NULL
Property changes on: php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation6.phpt
___________________________________________________________________
Added: svn:executable
+ *
Added: php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation8.phpt
===================================================================
--- php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation8.phpt (rev 0)
+++ php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation8.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,40 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with array values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with array values ***\n";
+
+$service = "www";
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with array values ***
+
+Warning: getservbyname() expects parameter 2 to be binary string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 2 to be binary string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 2 to be binary string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 2 to be binary string, array given in %s on line %d
+NULL
Property changes on: php/php-src/trunk/ext/standard/tests/general_functions/getservbyname_variation8.phpt
___________________________________________________________________
Added: svn:executable
+ *
Added: php/php-src/trunk/ext/standard/tests/general_functions/getservbyport_variation1.phpt
===================================================================
--- php/php-src/trunk/ext/standard/tests/general_functions/getservbyport_variation1.phpt (rev 0)
+++ php/php-src/trunk/ext/standard/tests/general_functions/getservbyport_variation1.phpt 2009-08-30 12:19:50 UTC (rev 287896)
@@ -0,0 +1,40 @@
+--TEST--
+Test function getservbyport() by calling it more than or less than its expected arguments
+--DESCRIPTION--
+Test function passing invalid port number and invalid protocol name
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci ([email protected])
+Michele Orselli ([email protected])
+Simone Gentili ([email protected])
+--FILE--
+<?php
+ var_dump(getservbyport( -1, "tcp" ));
+ var_dump(getservbyport( 80, "ppp" ));
+ var_dump(getservbyport( null, null));
+ var_dump(getservbyport( array(), array()));
+ var_dump(getservbyport( array(80), array("tcp")));
+ var_dump(getservbyport( array(2, 3), array("one"=>1, "two"=>2)));
+ var_dump(getservbyport( 2, 2));
+ var_dump(getservbyport( "80", "tcp"));
+ var_dump(getservbyport( new stdClass(), new stdClass()));
+
+?>
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+
+Warning: getservbyport() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+Warning: getservbyport() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+Warning: getservbyport() expects parameter 1 to be long, array given in %s on line %d
+NULL
+bool(false)
+unicode(%d) "%s"
+
+Warning: getservbyport() expects parameter 1 to be long, object given in %s on line %d
+NULL
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php