1--TEST-- 2get_defined_functions() function : basic functionality 3--FILE-- 4<?php 5 6/* Prototype : array get_defined_functions ( void ) 7 * Description: Gets an array of all defined functions. 8 * Source code: Zend/zend_builtin_functions.c 9*/ 10 11echo "*** Testing get_defined_functions() : basic functionality ***\n"; 12 13function foo() {} 14 15// mixed case function 16function HelloWorld() {} 17 18Class C { 19 function f1() {} 20 static function f2() {} 21} 22 23$func = get_defined_functions(); 24 25if (!is_array($func)) { 26 echo "TEST FAILED: return type not an array\n"; 27} 28 29 30if (!is_array($func["internal"])) { 31 echo "TEST FAILED: no element in result array with key 'internal'\n"; 32} 33 34$internal = $func["internal"]; 35 36//check for a few core functions 37if (!in_array("cos", $internal) || !in_array("strlen", $internal)) { 38 echo "TEST FAILED: missing elements from 'internal' array\n"; 39 var_dump($internal); 40} 41 42if (!is_array($func["user"])) { 43 echo "TEST FAILED: no element in result array with key 'user'\n"; 44} 45 46$user = $func["user"]; 47if (count($user) == 2 && in_array("foo", $user) && in_array("helloworld", $user)) { 48 echo "TEST PASSED\n"; 49} else { 50 echo "TEST FAILED: missing elements from 'user' array\n"; 51 var_dump($user); 52} 53 54?> 55===Done=== 56--EXPECT-- 57*** Testing get_defined_functions() : basic functionality *** 58TEST PASSED 59===Done=== 60