--- /dev/null
+--TEST--\r
+Test get_defined_constants() function : basic functionality \r
+--FILE--\r
+<?php\r
+/* Prototype : array get_defined_constants ([ bool $categorize ] )\r
+ * Description: Returns an associative array with the names of all the constants and their values\r
+ * Source code: Zend/zend_builtin_functions.c\r
+ */ \r
+\r
+echo "*** Testing get_defined_constants() : basic functionality ***\n";\r
+\r
+var_dump(gettype(get_defined_constants(true)));\r
+var_dump(gettype(get_defined_constants()));\r
+\r
+$arr1 = get_defined_constants(false);\r
+$arr2 = get_defined_constants();\r
+var_dump(array_diff($arr1, $arr2));\r
+\r
+$n1 = count(get_defined_constants());\r
+define("USER_CONSTANT", "test");\r
+$arr2 = get_defined_constants();\r
+$n2 = count($arr2);\r
+\r
+if ($n2 == $n1 + 1 && array_key_exists("USER_CONSTANT", $arr2)) {\r
+ echo "TEST PASSED\n";\r
+} else {\r
+ echo "TEST FAILED\n";\r
+}\r
+\r
+?>\r
+===DONE===\r
+--EXPECTF-- \r
+*** Testing get_defined_constants() : basic functionality ***\r
+unicode(5) "array"\r
+unicode(5) "array"\r
+array(0) {\r
+}\r
+TEST PASSED\r
+===DONE===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test get_defined_constants() function : error conditions
+--FILE--
+<?php
+/* Prototype : array get_defined_constants ([ bool $categorize ] )
+ * Description: Returns an associative array with the names of all the constants and their values
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_defined_constants() : error conditions ***\n";
+
+echo "\n-- Testing get_defined_constants() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( get_defined_constants(true, $extra_arg) );
+
+?>
+===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
--- /dev/null
+--TEST--\r
+Test get_loaded_extensions() function : basic functionality \r
+--FILE--\r
+<?php\r
+/* Prototype : array get_loaded_extensions ([ bool $zend_extensions= false ] )\r
+ * Description: Returns an array with the names of all modules compiled and loaded\r
+ * Source code: Zend/zend_builtin_functions.c\r
+ */ \r
+\r
+echo "*** Testing get_loaded_extensions() : basic functionality ***\n";\r
+\r
+echo "Get loaded extensions\n";\r
+var_dump(get_loaded_extensions());\r
+\r
+?>\r
+===DONE===\r
+--EXPECTF--\r
+*** Testing get_loaded_extensions() : basic functionality ***\r
+Get loaded extensions\r
+array(%d) {\r
+%a\r
+}\r
+===DONE===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test get_loaded_extensions() function : error conditions
+--FILE--
+<?php
+/* Prototype : array get_loaded_extensions ([ bool $zend_extensions= false ] )
+ * Description: Returns an array with the names of all modules compiled and loaded
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_loaded_extensions() : error conditions ***\n";
+
+echo "\n-- Testing get_loaded_extensions() function with more than expected no. of arguments --\n";
+$res = fopen(__FILE__, "r");
+$extra_arg = 10;
+var_dump( get_resource_type(true, $extra_arg) );
+
+?>
+===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
--- /dev/null
+--TEST--
+Test get_resource_type() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string get_resource_type ( resource $handle )
+ * Description: Returns the resource type
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_resource_type() : basic functionality ***\n";
+
+$res = fopen(__FILE__, "r");
+var_dump(get_resource_type($res));
+
+?>
+===DONE===
+--EXPECT--
+*** Testing get_resource_type() : basic functionality ***
+unicode(6) "stream"
+===DONE===
--- /dev/null
+--TEST--
+Test get_resource_type() function : error conditions
+--FILE--
+<?php
+/* Prototype : string get_resource_type ( resource $handle )
+ * Description: Returns the resource type
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_resource_type() : error conditions ***\n";
+
+echo "\n-- Testing get_resource_type() function with Zero arguments --\n";
+var_dump( get_resource_type() );
+
+echo "\n-- Testing get_resource_type() function with more than expected no. of arguments --\n";
+$res = fopen(__FILE__, "r");
+$extra_arg = 10;
+var_dump( get_resource_type($res, $extra_arg) );
+
+?>
+===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
--- /dev/null
+--TEST--
+Test get_resource_type() function : usage variations - different data types as handle arg
+--FILE--
+<?php
+/* Prototype : string get_resource_type ( resource $handle )
+ * Description: Returns the resource type
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_resource_type() : variation test ***\n";
+
+class Hello {
+ public function SayHello($arg) {
+ echo "Hello\n";
+ }
+}
+
+$res = fopen(__FILE__, "r");
+
+$vars = array(
+ "bool"=>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