Annotation of embedaddon/php/Zend/tests/get_defined_functions_basic.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: get_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: 
        !            11: echo "*** Testing get_defined_functions() : basic functionality ***\n";
        !            12: 
        !            13: function foo() {}
        !            14: 
        !            15: // mixed case function
        !            16: function HelloWorld() {}
        !            17: 
        !            18: Class C {
        !            19:        function f1() {}
        !            20:        static function f2() {}
        !            21: }
        !            22: 
        !            23: $func = get_defined_functions();
        !            24: 
        !            25: if (!is_array($func)) {
        !            26:        echo "TEST FAILED: return type not an array\n";
        !            27: }
        !            28: 
        !            29: 
        !            30: if (!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
        !            37: if (!in_array("cos", $internal) || !in_array("strlen", $internal)) {
        !            38:        echo "TEST FAILED: missing elements from 'internal' array\n";
        !            39:        var_dump($internal);
        !            40: } 
        !            41: 
        !            42: if (!is_array($func["user"])) {
        !            43:        echo "TEST FAILED: no element in result array with key 'user'\n";
        !            44: }
        !            45: 
        !            46: $user = $func["user"];
        !            47: if (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 ***
        !            58: TEST PASSED
        !            59: ===Done===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>