From: andy wharmby Date: Mon, 3 Aug 2009 23:12:43 +0000 (+0000) Subject: New basic tests for get_defined_constants(), get_loaded_extensions() and get_resource... X-Git-Tag: php-5.4.0alpha1~191^2~2869 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f868c5d10bcd58f172833c4994dabad4f24ea11d;p=php New basic tests for get_defined_constants(), get_loaded_extensions() and get_resource_type() functions. Tested on Windows, Linux and Linux 64 bit --- diff --git a/ext/standard/tests/general_functions/get_defined_constants_basic.phpt b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt new file mode 100644 index 0000000000..dea5e4f87f --- /dev/null +++ b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test get_defined_constants() function : basic functionality +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing get_defined_constants() : basic functionality *** +unicode(5) "array" +unicode(5) "array" +array(0) { +} +TEST PASSED +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/general_functions/get_defined_constants_error.phpt b/ext/standard/tests/general_functions/get_defined_constants_error.phpt new file mode 100644 index 0000000000..1092712ee9 --- /dev/null +++ b/ext/standard/tests/general_functions/get_defined_constants_error.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test get_defined_constants() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing get_defined_constants() : error conditions *** + +-- Testing get_defined_constants() function with more than expected no. of arguments -- + +Warning: get_defined_constants() expects at most 1 parameter, 2 given in %s on line 11 +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt b/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt new file mode 100644 index 0000000000..4a8eceb24b --- /dev/null +++ b/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test get_loaded_extensions() function : basic functionality +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing get_loaded_extensions() : basic functionality *** +Get loaded extensions +array(%d) { +%a +} +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/general_functions/get_loaded_extensions_error.phpt b/ext/standard/tests/general_functions/get_loaded_extensions_error.phpt new file mode 100644 index 0000000000..d731046dc6 --- /dev/null +++ b/ext/standard/tests/general_functions/get_loaded_extensions_error.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test get_loaded_extensions() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing get_loaded_extensions() : error conditions *** + +-- Testing get_loaded_extensions() function with more than expected no. of arguments -- + +Warning: get_resource_type() 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/get_resource_type_basic.phpt b/ext/standard/tests/general_functions/get_resource_type_basic.phpt new file mode 100644 index 0000000000..9bd945cdc4 --- /dev/null +++ b/ext/standard/tests/general_functions/get_resource_type_basic.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test get_resource_type() function : basic functionality +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing get_resource_type() : basic functionality *** +unicode(6) "stream" +===DONE=== diff --git a/ext/standard/tests/general_functions/get_resource_type_error.phpt b/ext/standard/tests/general_functions/get_resource_type_error.phpt new file mode 100644 index 0000000000..40dcf07799 --- /dev/null +++ b/ext/standard/tests/general_functions/get_resource_type_error.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test get_resource_type() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing get_resource_type() : error conditions *** + +-- Testing get_resource_type() function with Zero arguments -- + +Warning: get_resource_type() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing get_resource_type() function with more than expected no. of arguments -- + +Warning: get_resource_type() 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/get_resource_type_variation1.phpt b/ext/standard/tests/general_functions/get_resource_type_variation1.phpt new file mode 100644 index 0000000000..b09cabca83 --- /dev/null +++ b/ext/standard/tests/general_functions/get_resource_type_variation1.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test get_resource_type() function : usage variations - different data types as handle arg +--FILE-- +false, + "int 10"=>10, + "float 10.5"=>10.5, + "string"=>"Hello World", + "array"=>array(1,2,3,4,5), + "NULL"=>NULL, + "Object"=>new Hello() +); + +foreach($vars as $variation =>$object) { + echo "\n-- $variation --\n"; + var_dump(get_resource_type($object)); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing get_resource_type() : variation test *** + +-- bool -- + +Warning: get_resource_type() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +-- int 10 -- + +Warning: get_resource_type() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +-- float 10.5 -- + +Warning: get_resource_type() expects parameter 1 to be resource, double given in %s on line %d +NULL + +-- string -- + +Warning: get_resource_type() expects parameter 1 to be resource, Unicode string given in %s on line %d +NULL + +-- array -- + +Warning: get_resource_type() expects parameter 1 to be resource, array given in %s on line %d +NULL + +-- NULL -- + +Warning: get_resource_type() expects parameter 1 to be resource, null given in %s on line %d +NULL + +-- Object -- + +Warning: get_resource_type() expects parameter 1 to be resource, object given in %s on line %d +NULL +===DONE=== \ No newline at end of file