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.2.11RC1~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fbb3bc2b8cdd28eef49ab75ecf2b29034ee30074;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..9e2e66c94c --- /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 *** +string(5) "array" +string(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..08d819a5bf --- /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_loaded_extensions() expects at most 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..7ff4aec2c3 --- /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 *** +string(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..9b7e157326 --- /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: Wrong parameter count for get_resource_type() in %s on line %d +NULL + +-- Testing get_resource_type() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for get_resource_type() 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..95b933b0e1 --- /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: Supplied argument is not a valid resource handle in %s on line %d +bool(false) + +-- int 10 -- + +Warning: Supplied argument is not a valid resource handle in %s on line %d +bool(false) + +-- float 10.5 -- + +Warning: Supplied argument is not a valid resource handle in %s on line %d +bool(false) + +-- string -- + +Warning: Supplied argument is not a valid resource handle in %s on line %d +bool(false) + +-- array -- + +Warning: Supplied argument is not a valid resource handle in %s on line %d +bool(false) + +-- NULL -- + +Warning: Supplied argument is not a valid resource handle in %s on line %d +bool(false) + +-- Object -- + +Warning: Supplied argument is not a valid resource handle in %s on line %d +bool(false) +===DONE=== \ No newline at end of file