From: andy wharmby Date: Wed, 5 Aug 2009 16:10:46 +0000 (+0000) Subject: Basic test for is_resource() and isset() functions. tested on Windows, Linux and... X-Git-Tag: php-5.4.0alpha1~191^2~2849 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f2c4140cfef6eac478623aef0107c83c4d2cce7f;p=php Basic test for is_resource() and isset() functions. tested on Windows, Linux and Linux 64 --- diff --git a/ext/standard/tests/general_functions/is_resource_basic.phpt b/ext/standard/tests/general_functions/is_resource_basic.phpt new file mode 100644 index 0000000000..27583d3d87 --- /dev/null +++ b/ext/standard/tests/general_functions/is_resource_basic.phpt @@ -0,0 +1,92 @@ +--TEST-- +Test is_resource() function : basic functionality +--FILE-- + +===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=== diff --git a/ext/standard/tests/general_functions/is_resource_error.phpt b/ext/standard/tests/general_functions/is_resource_error.phpt new file mode 100644 index 0000000000..731cd0bd85 --- /dev/null +++ b/ext/standard/tests/general_functions/is_resource_error.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test is_resource() function : error conditions +--FILE-- + +===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 diff --git a/ext/standard/tests/general_functions/isset_basic1.phpt b/ext/standard/tests/general_functions/isset_basic1.phpt new file mode 100644 index 0000000000..4c03210342 --- /dev/null +++ b/ext/standard/tests/general_functions/isset_basic1.phpt @@ -0,0 +1,66 @@ +--TEST-- +Test isset() function : basic functionality +--FILE-- + +===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 diff --git a/ext/standard/tests/general_functions/isset_basic2.phpt b/ext/standard/tests/general_functions/isset_basic2.phpt new file mode 100644 index 0000000000..9137aeb922 --- /dev/null +++ b/ext/standard/tests/general_functions/isset_basic2.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test isset() function : basic functionality +--FILE-- + +===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