From 3b9ebac846b91ba70b3ce5a5f9e550e21b74f0c5 Mon Sep 17 00:00:00 2001 From: andy wharmby Date: Wed, 5 Aug 2009 16:10:46 +0000 Subject: [PATCH] Basic test for is_resource() and isset() functions. tested on Windows, Linux and Linux 64 --- .../general_functions/is_resource_basic.phpt | 92 +++++++++++++++++++ .../general_functions/is_resource_error.phpt | 34 +++++++ .../tests/general_functions/isset_basic1.phpt | 66 +++++++++++++ .../tests/general_functions/isset_basic2.phpt | 60 ++++++++++++ 4 files changed, 252 insertions(+) create mode 100644 ext/standard/tests/general_functions/is_resource_basic.phpt create mode 100644 ext/standard/tests/general_functions/is_resource_error.phpt create mode 100644 ext/standard/tests/general_functions/isset_basic1.phpt create mode 100644 ext/standard/tests/general_functions/isset_basic2.phpt 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..f0619fa733 --- /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(): 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 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 -- 2.40.0