wharmby Wed, 05 Aug 2009 16:10:46 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=286847
Log: Basic test for is_resource() and isset() functions. tested on Windows, Linux and Linux 64 Changed paths: A php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/is_resource_basic.phpt A php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/is_resource_error.phpt A php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/isset_basic1.phpt A php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/isset_basic2.phpt A php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/is_resource_basic.phpt A php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/is_resource_error.phpt A php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/isset_basic1.phpt A php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/isset_basic2.phpt A php/php-src/trunk/ext/standard/tests/general_functions/is_resource_basic.phpt A php/php-src/trunk/ext/standard/tests/general_functions/is_resource_error.phpt A php/php-src/trunk/ext/standard/tests/general_functions/isset_basic1.phpt A php/php-src/trunk/ext/standard/tests/general_functions/isset_basic2.phpt
Added: php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/is_resource_basic.phpt =================================================================== --- php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/is_resource_basic.phpt (rev 0) +++ php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/is_resource_basic.phpt 2009-08-05 16:10:46 UTC (rev 286847) @@ -0,0 +1,92 @@ +--TEST-- +Test is_resource() function : basic functionality +--FILE-- +<?php +/* Prototype : bool is_resource ( mixed $var ) + * Description: Finds whether a variable is a resource + * Source code: ext/standard/type.c + */ + +echo "*** Testing is_resource() : basic functionality ***\n"; + +class Hello { + public function SayHello($arg) { + echo "Hello\n"; + } +} + + +$vars = array( + false, + true, + 10, + 10.5, + "Helo World", + array(1,2,3,4,5), + NULL, + new Hello()); + +$types = array( + "bool=false", + "bool=true", + "integer", + "double", + "string", + "array", + "NULL", + "object"); + +echo "\nNon-resource type cases\n"; + +for ($i=0; $i < count($vars); $i++) { + if (is_resource($vars[$i])) { + echo $types[$i]. " test returns TRUE\n"; + } else { + echo $types[$i]. " test returns FALSE\n"; + } +} + +$res = fopen(__FILE__, "r"); +echo "\nResource type..var_dump after file open returns\n"; +var_dump($res); +echo "Resource type..after file open is_resource() returns"; +if (is_resource($res)) { + echo " TRUE\n"; +} else { + echo " FALSE\n"; +} + +fclose($res); +echo "\nResource type..var_dump after file close returns\n"; +var_dump($res); +echo "Resource type..after file close is_resource() returns"; +if (is_resource($res)) { + echo " TRUE\n"; +} else { + echo " FALSE\n"; +} + + +?> +===DONE=== +--EXPECTF-- +*** Testing is_resource() : basic functionality *** + +Non-resource type cases +bool=false test returns FALSE +bool=true test returns FALSE +integer test returns FALSE +double test returns FALSE +string test returns FALSE +array test returns FALSE +NULL test returns FALSE +object test returns FALSE + +Resource type..var_dump after file open returns +resource(%d) of type (%s) +Resource type..after file open is_resource() returns TRUE + +Resource type..var_dump after file close returns +resource(%d) of type (Unknown) +Resource type..after file close is_resource() returns FALSE +===DONE=== Added: php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/is_resource_error.phpt =================================================================== --- php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/is_resource_error.phpt (rev 0) +++ php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/is_resource_error.phpt 2009-08-05 16:10:46 UTC (rev 286847) @@ -0,0 +1,34 @@ +--TEST-- +Test is_resource() function : error conditions +--FILE-- +<?php +/* Prototype : bool is_resource ( mixed $var ) + * Description: Finds whether a variable is a resource + * Source code: ext/standard/type.c + */ + +echo "*** Testing is_resource() : error conditions ***\n"; + +echo "\n-- Testing is_resource() function with Zero arguments --\n"; +var_dump( is_resource() ); + +echo "\n-- Testing is_resource() function with more than expected no. of arguments --\n"; +$res = fopen(__FILE__, "r"); +$extra_arg = 10; +var_dump( is_resource($res, $extra_arg) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing is_resource() : error conditions *** + +-- Testing is_resource() function with Zero arguments -- + +Warning: is_resource(): Only one argument expected in %s on line %d +bool(false) + +-- Testing is_resource() function with more than expected no. of arguments -- + +Warning: is_resource(): Only one argument expected in %s on line %d +bool(false) +===DONE=== \ No newline at end of file Added: php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/isset_basic1.phpt =================================================================== --- php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/isset_basic1.phpt (rev 0) +++ php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/isset_basic1.phpt 2009-08-05 16:10:46 UTC (rev 286847) @@ -0,0 +1,66 @@ +--TEST-- +Test isset() function : basic functionality +--FILE-- +<?php +/* Prototype : bool isset ( mixed $var [, mixed $var [, $... ]] ) + * Description: Determine if a variable is set and is not NULL + */ + +class foo {} + +echo "*** Testing isset() : basic functionality ***\n"; + +$i = 10; +$f = 10.5; +$s = "Hello"; +$a = array(1,2,3,4,5); +$b = true; +$n = NULL; +$obj = new foo; +$res = fopen(__FILE__, "r"); + +echo "Integer test: " . (isset($i) ? "YES": "NO") . "\n"; +echo "Float test: " . (isset($f) ? "YES": "NO") . "\n"; +echo "String test: " . (isset($s) ? "YES": "NO") . "\n"; +echo "Array test: " . (isset($a) ? "YES": "NO") . "\n"; +echo "Boolean test: " . (isset($b) ? "YES": "NO") . "\n"; +echo "Null test: " . (isset($n) ? "YES": "NO") . "\n"; +echo "Object test: " . (isset($obj) ? "YES": "NO") . "\n"; +echo "Resource test: " . (isset($res) ? "YES": "NO") . "\n"; + +echo "\n\nUnset the variables\n\n"; +unset($i, $f, $s, $a, $b, $n, $obj, $res); + +echo "Integer test: " . (isset($i) ? "YES": "NO") . "\n"; +echo "Float test: " . (isset($f) ? "YES": "NO") . "\n"; +echo "String test: " . (isset($s) ? "YES": "NO") . "\n"; +echo "Array test: " . (isset($a) ? "YES": "NO") . "\n"; +echo "Boolean test: " . (isset($b) ? "YES": "NO") . "\n"; +echo "Null test: " . (isset($n) ? "YES": "NO") . "\n"; +echo "Object test: " . (isset($obj) ? "YES": "NO") . "\n"; +echo "Resource test: " . (isset($res) ? "YES": "NO") . "\n"; +?> +===DONE=== +--EXPECT-- +*** Testing isset() : basic functionality *** +Integer test: YES +Float test: YES +String test: YES +Array test: YES +Boolean test: YES +Null test: NO +Object test: YES +Resource test: YES + + +Unset the variables + +Integer test: NO +Float test: NO +String test: NO +Array test: NO +Boolean test: NO +Null test: NO +Object test: NO +Resource test: NO +===DONE=== \ No newline at end of file Added: php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/isset_basic2.phpt =================================================================== --- php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/isset_basic2.phpt (rev 0) +++ php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/isset_basic2.phpt 2009-08-05 16:10:46 UTC (rev 286847) @@ -0,0 +1,60 @@ +--TEST-- +Test isset() function : basic functionality +--FILE-- +<?php +/* Prototype : bool isset ( mixed $var [, mixed $var [, $... ]] ) + * Description: Determine if a variable is set and is not NULL + */ + +class foo {} + +echo "*** Testing isset() : basic functionality ***\n"; + +$i = 10; +$f = 10.5; +$s = "Hello"; +$b = true; +$n = NULL; + +echo "Test multiple scalar variables in a group\n"; +var_dump(isset($i, $f, $s, $b)); +var_dump(isset($i, $f, $s, $b, $n)); + +echo "Unset a few\n"; +unset($i, $b); + +echo "Test again\n"; +var_dump(isset($i, $f, $s, $b)); + +echo "\n\nArray test:\n"; +$arr = array(); +var_dump(isset($var)); +var_dump(isset($var[1])); +var_dump(isset($var, $var[1])); +echo "..now set\n"; +$var[1] = 10; +var_dump(isset($var)); +var_dump(isset($var[1])); +var_dump(isset($var, $var[1])); + +?> +===DONE=== +--EXPECT-- +*** Testing isset() : basic functionality *** +Test multiple scalar variables in a group +bool(true) +bool(false) +Unset a few +Test again +bool(false) + + +Array test: +bool(false) +bool(false) +bool(false) +..now set +bool(true) +bool(true) +bool(true) +===DONE=== \ No newline at end of file Added: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/is_resource_basic.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/is_resource_basic.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/is_resource_basic.phpt 2009-08-05 16:10:46 UTC (rev 286847) @@ -0,0 +1,92 @@ +--TEST-- +Test is_resource() function : basic functionality +--FILE-- +<?php +/* Prototype : bool is_resource ( mixed $var ) + * Description: Finds whether a variable is a resource + * Source code: ext/standard/type.c + */ + +echo "*** Testing is_resource() : basic functionality ***\n"; + +class Hello { + public function SayHello($arg) { + echo "Hello\n"; + } +} + + +$vars = array( + false, + true, + 10, + 10.5, + "Helo World", + array(1,2,3,4,5), + NULL, + new Hello()); + +$types = array( + "bool=false", + "bool=true", + "integer", + "double", + "string", + "array", + "NULL", + "object"); + +echo "\nNon-resource type cases\n"; + +for ($i=0; $i < count($vars); $i++) { + if (is_resource($vars[$i])) { + echo $types[$i]. " test returns TRUE\n"; + } else { + echo $types[$i]. " test returns FALSE\n"; + } +} + +$res = fopen(__FILE__, "r"); +echo "\nResource type..var_dump after file open returns\n"; +var_dump($res); +echo "Resource type..after file open is_resource() returns"; +if (is_resource($res)) { + echo " TRUE\n"; +} else { + echo " FALSE\n"; +} + +fclose($res); +echo "\nResource type..var_dump after file close returns\n"; +var_dump($res); +echo "Resource type..after file close is_resource() returns"; +if (is_resource($res)) { + echo " TRUE\n"; +} else { + echo " FALSE\n"; +} + + +?> +===DONE=== +--EXPECTF-- +*** Testing is_resource() : basic functionality *** + +Non-resource type cases +bool=false test returns FALSE +bool=true test returns FALSE +integer test returns FALSE +double test returns FALSE +string test returns FALSE +array test returns FALSE +NULL test returns FALSE +object test returns FALSE + +Resource type..var_dump after file open returns +resource(%d) of type (%s) +Resource type..after file open is_resource() returns TRUE + +Resource type..var_dump after file close returns +resource(%d) of type (Unknown) +Resource type..after file close is_resource() returns FALSE +===DONE=== Added: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/is_resource_error.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/is_resource_error.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/is_resource_error.phpt 2009-08-05 16:10:46 UTC (rev 286847) @@ -0,0 +1,34 @@ +--TEST-- +Test is_resource() function : error conditions +--FILE-- +<?php +/* Prototype : bool is_resource ( mixed $var ) + * Description: Finds whether a variable is a resource + * Source code: ext/standard/type.c + */ + +echo "*** Testing is_resource() : error conditions ***\n"; + +echo "\n-- Testing is_resource() function with Zero arguments --\n"; +var_dump( is_resource() ); + +echo "\n-- Testing is_resource() function with more than expected no. of arguments --\n"; +$res = fopen(__FILE__, "r"); +$extra_arg = 10; +var_dump( is_resource($res, $extra_arg) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing is_resource() : error conditions *** + +-- Testing is_resource() function with Zero arguments -- + +Warning: is_resource() expects exactly 1 parameter, 0 given in %s on line %d +bool(false) + +-- Testing is_resource() function with more than expected no. of arguments -- + +Warning: is_resource() expects exactly 1 parameter, 2 given in %s on line %d +bool(false) +===DONE=== \ No newline at end of file Added: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/isset_basic1.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/isset_basic1.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/isset_basic1.phpt 2009-08-05 16:10:46 UTC (rev 286847) @@ -0,0 +1,66 @@ +--TEST-- +Test isset() function : basic functionality +--FILE-- +<?php +/* Prototype : bool isset ( mixed $var [, mixed $var [, $... ]] ) + * Description: Determine if a variable is set and is not NULL + */ + +class foo {} + +echo "*** Testing isset() : basic functionality ***\n"; + +$i = 10; +$f = 10.5; +$s = "Hello"; +$a = array(1,2,3,4,5); +$b = true; +$n = NULL; +$obj = new foo; +$res = fopen(__FILE__, "r"); + +echo "Integer test: " . (isset($i) ? "YES": "NO") . "\n"; +echo "Float test: " . (isset($f) ? "YES": "NO") . "\n"; +echo "String test: " . (isset($s) ? "YES": "NO") . "\n"; +echo "Array test: " . (isset($a) ? "YES": "NO") . "\n"; +echo "Boolean test: " . (isset($b) ? "YES": "NO") . "\n"; +echo "Null test: " . (isset($n) ? "YES": "NO") . "\n"; +echo "Object test: " . (isset($obj) ? "YES": "NO") . "\n"; +echo "Resource test: " . (isset($res) ? "YES": "NO") . "\n"; + +echo "\n\nUnset the variables\n\n"; +unset($i, $f, $s, $a, $b, $n, $obj, $res); + +echo "Integer test: " . (isset($i) ? "YES": "NO") . "\n"; +echo "Float test: " . (isset($f) ? "YES": "NO") . "\n"; +echo "String test: " . (isset($s) ? "YES": "NO") . "\n"; +echo "Array test: " . (isset($a) ? "YES": "NO") . "\n"; +echo "Boolean test: " . (isset($b) ? "YES": "NO") . "\n"; +echo "Null test: " . (isset($n) ? "YES": "NO") . "\n"; +echo "Object test: " . (isset($obj) ? "YES": "NO") . "\n"; +echo "Resource test: " . (isset($res) ? "YES": "NO") . "\n"; +?> +===DONE=== +--EXPECT-- +*** Testing isset() : basic functionality *** +Integer test: YES +Float test: YES +String test: YES +Array test: YES +Boolean test: YES +Null test: NO +Object test: YES +Resource test: YES + + +Unset the variables + +Integer test: NO +Float test: NO +String test: NO +Array test: NO +Boolean test: NO +Null test: NO +Object test: NO +Resource test: NO +===DONE=== \ No newline at end of file Added: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/isset_basic2.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/isset_basic2.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/isset_basic2.phpt 2009-08-05 16:10:46 UTC (rev 286847) @@ -0,0 +1,60 @@ +--TEST-- +Test isset() function : basic functionality +--FILE-- +<?php +/* Prototype : bool isset ( mixed $var [, mixed $var [, $... ]] ) + * Description: Determine if a variable is set and is not NULL + */ + +class foo {} + +echo "*** Testing isset() : basic functionality ***\n"; + +$i = 10; +$f = 10.5; +$s = "Hello"; +$b = true; +$n = NULL; + +echo "Test multiple scalar variables in a group\n"; +var_dump(isset($i, $f, $s, $b)); +var_dump(isset($i, $f, $s, $b, $n)); + +echo "Unset a few\n"; +unset($i, $b); + +echo "Test again\n"; +var_dump(isset($i, $f, $s, $b)); + +echo "\n\nArray test:\n"; +$arr = array(); +var_dump(isset($var)); +var_dump(isset($var[1])); +var_dump(isset($var, $var[1])); +echo "..now set\n"; +$var[1] = 10; +var_dump(isset($var)); +var_dump(isset($var[1])); +var_dump(isset($var, $var[1])); + +?> +===DONE=== +--EXPECT-- +*** Testing isset() : basic functionality *** +Test multiple scalar variables in a group +bool(true) +bool(false) +Unset a few +Test again +bool(false) + + +Array test: +bool(false) +bool(false) +bool(false) +..now set +bool(true) +bool(true) +bool(true) +===DONE=== \ No newline at end of file Added: php/php-src/trunk/ext/standard/tests/general_functions/is_resource_basic.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/general_functions/is_resource_basic.phpt (rev 0) +++ php/php-src/trunk/ext/standard/tests/general_functions/is_resource_basic.phpt 2009-08-05 16:10:46 UTC (rev 286847) @@ -0,0 +1,92 @@ +--TEST-- +Test is_resource() function : basic functionality +--FILE-- +<?php +/* Prototype : bool is_resource ( mixed $var ) + * Description: Finds whether a variable is a resource + * Source code: ext/standard/type.c + */ + +echo "*** Testing is_resource() : basic functionality ***\n"; + +class Hello { + public function SayHello($arg) { + echo "Hello\n"; + } +} + + +$vars = array( + false, + true, + 10, + 10.5, + "Helo World", + array(1,2,3,4,5), + NULL, + new Hello()); + +$types = array( + "bool=false", + "bool=true", + "integer", + "double", + "string", + "array", + "NULL", + "object"); + +echo "\nNon-resource type cases\n"; + +for ($i=0; $i < count($vars); $i++) { + if (is_resource($vars[$i])) { + echo $types[$i]. " test returns TRUE\n"; + } else { + echo $types[$i]. " test returns FALSE\n"; + } +} + +$res = fopen(__FILE__, "r"); +echo "\nResource type..var_dump after file open returns\n"; +var_dump($res); +echo "Resource type..after file open is_resource() returns"; +if (is_resource($res)) { + echo " TRUE\n"; +} else { + echo " FALSE\n"; +} + +fclose($res); +echo "\nResource type..var_dump after file close returns\n"; +var_dump($res); +echo "Resource type..after file close is_resource() returns"; +if (is_resource($res)) { + echo " TRUE\n"; +} else { + echo " FALSE\n"; +} + + +?> +===DONE=== +--EXPECTF-- +*** Testing is_resource() : basic functionality *** + +Non-resource type cases +bool=false test returns FALSE +bool=true test returns FALSE +integer test returns FALSE +double test returns FALSE +string test returns FALSE +array test returns FALSE +NULL test returns FALSE +object test returns FALSE + +Resource type..var_dump after file open returns +resource(%d) of type (%s) +Resource type..after file open is_resource() returns TRUE + +Resource type..var_dump after file close returns +resource(%d) of type (Unknown) +Resource type..after file close is_resource() returns FALSE +===DONE=== Added: php/php-src/trunk/ext/standard/tests/general_functions/is_resource_error.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/general_functions/is_resource_error.phpt (rev 0) +++ php/php-src/trunk/ext/standard/tests/general_functions/is_resource_error.phpt 2009-08-05 16:10:46 UTC (rev 286847) @@ -0,0 +1,34 @@ +--TEST-- +Test is_resource() function : error conditions +--FILE-- +<?php +/* Prototype : bool is_resource ( mixed $var ) + * Description: Finds whether a variable is a resource + * Source code: ext/standard/type.c + */ + +echo "*** Testing is_resource() : error conditions ***\n"; + +echo "\n-- Testing is_resource() function with Zero arguments --\n"; +var_dump( is_resource() ); + +echo "\n-- Testing is_resource() function with more than expected no. of arguments --\n"; +$res = fopen(__FILE__, "r"); +$extra_arg = 10; +var_dump( is_resource($res, $extra_arg) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing is_resource() : error conditions *** + +-- Testing is_resource() function with Zero arguments -- + +Warning: is_resource() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing is_resource() function with more than expected no. of arguments -- + +Warning: is_resource() expects exactly 1 parameter, 2 given in %s on line %d +NULL +===DONE=== \ No newline at end of file Added: php/php-src/trunk/ext/standard/tests/general_functions/isset_basic1.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/general_functions/isset_basic1.phpt (rev 0) +++ php/php-src/trunk/ext/standard/tests/general_functions/isset_basic1.phpt 2009-08-05 16:10:46 UTC (rev 286847) @@ -0,0 +1,66 @@ +--TEST-- +Test isset() function : basic functionality +--FILE-- +<?php +/* Prototype : bool isset ( mixed $var [, mixed $var [, $... ]] ) + * Description: Determine if a variable is set and is not NULL + */ + +class foo {} + +echo "*** Testing isset() : basic functionality ***\n"; + +$i = 10; +$f = 10.5; +$s = "Hello"; +$a = array(1,2,3,4,5); +$b = true; +$n = NULL; +$obj = new foo; +$res = fopen(__FILE__, "r"); + +echo "Integer test: " . (isset($i) ? "YES": "NO") . "\n"; +echo "Float test: " . (isset($f) ? "YES": "NO") . "\n"; +echo "String test: " . (isset($s) ? "YES": "NO") . "\n"; +echo "Array test: " . (isset($a) ? "YES": "NO") . "\n"; +echo "Boolean test: " . (isset($b) ? "YES": "NO") . "\n"; +echo "Null test: " . (isset($n) ? "YES": "NO") . "\n"; +echo "Object test: " . (isset($obj) ? "YES": "NO") . "\n"; +echo "Resource test: " . (isset($res) ? "YES": "NO") . "\n"; + +echo "\n\nUnset the variables\n\n"; +unset($i, $f, $s, $a, $b, $n, $obj, $res); + +echo "Integer test: " . (isset($i) ? "YES": "NO") . "\n"; +echo "Float test: " . (isset($f) ? "YES": "NO") . "\n"; +echo "String test: " . (isset($s) ? "YES": "NO") . "\n"; +echo "Array test: " . (isset($a) ? "YES": "NO") . "\n"; +echo "Boolean test: " . (isset($b) ? "YES": "NO") . "\n"; +echo "Null test: " . (isset($n) ? "YES": "NO") . "\n"; +echo "Object test: " . (isset($obj) ? "YES": "NO") . "\n"; +echo "Resource test: " . (isset($res) ? "YES": "NO") . "\n"; +?> +===DONE=== +--EXPECT-- +*** Testing isset() : basic functionality *** +Integer test: YES +Float test: YES +String test: YES +Array test: YES +Boolean test: YES +Null test: NO +Object test: YES +Resource test: YES + + +Unset the variables + +Integer test: NO +Float test: NO +String test: NO +Array test: NO +Boolean test: NO +Null test: NO +Object test: NO +Resource test: NO +===DONE=== \ No newline at end of file Added: php/php-src/trunk/ext/standard/tests/general_functions/isset_basic2.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/general_functions/isset_basic2.phpt (rev 0) +++ php/php-src/trunk/ext/standard/tests/general_functions/isset_basic2.phpt 2009-08-05 16:10:46 UTC (rev 286847) @@ -0,0 +1,60 @@ +--TEST-- +Test isset() function : basic functionality +--FILE-- +<?php +/* Prototype : bool isset ( mixed $var [, mixed $var [, $... ]] ) + * Description: Determine if a variable is set and is not NULL + */ + +class foo {} + +echo "*** Testing isset() : basic functionality ***\n"; + +$i = 10; +$f = 10.5; +$s = "Hello"; +$b = true; +$n = NULL; + +echo "Test multiple scalar variables in a group\n"; +var_dump(isset($i, $f, $s, $b)); +var_dump(isset($i, $f, $s, $b, $n)); + +echo "Unset a few\n"; +unset($i, $b); + +echo "Test again\n"; +var_dump(isset($i, $f, $s, $b)); + +echo "\n\nArray test:\n"; +$arr = array(); +var_dump(isset($var)); +var_dump(isset($var[1])); +var_dump(isset($var, $var[1])); +echo "..now set\n"; +$var[1] = 10; +var_dump(isset($var)); +var_dump(isset($var[1])); +var_dump(isset($var, $var[1])); + +?> +===DONE=== +--EXPECT-- +*** Testing isset() : basic functionality *** +Test multiple scalar variables in a group +bool(true) +bool(false) +Unset a few +Test again +bool(false) + + +Array test: +bool(false) +bool(false) +bool(false) +..now set +bool(true) +bool(true) +bool(true) +===DONE=== \ No newline at end of file
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php