Return to get_declared_interfaces_basic_001.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / class_object |
1.1 misho 1: --TEST-- 2: Test get_declared_interfaces() function : basic functionality 3: --FILE-- 4: <?php 5: /* Prototype : proto array get_declared_interfaces() 6: * Description: Returns an array of all declared interfaces. 7: * Source code: Zend/zend_builtin_functions.c 8: * Alias to functions: 9: */ 10: 11: 12: echo "*** Testing get_declared_interfaces() : basic functionality ***\n"; 13: 14: // Zero arguments 15: echo "\n-- Testing get_declared_interfaces() function with Zero arguments --\n"; 16: var_dump(get_declared_interfaces()); 17: 18: foreach (get_declared_interfaces() as $interface) { 19: if (!interface_exists($interface)) { 20: echo "Error: $interface is not a valid interface.\n"; 21: } 22: } 23: 24: echo "\n-- Ensure userspace classes are not listed --\n"; 25: Class C {} 26: var_dump(in_array('C', get_declared_interfaces())); 27: 28: echo "\n-- Ensure userspace interfaces are listed --\n"; 29: Interface I {} 30: var_dump(in_array('I', get_declared_interfaces())); 31: 32: echo "Done"; 33: ?> 34: --EXPECTF-- 35: *** Testing get_declared_interfaces() : basic functionality *** 36: 37: -- Testing get_declared_interfaces() function with Zero arguments -- 38: array(%d) { 39: %a 40: } 41: 42: -- Ensure userspace classes are not listed -- 43: bool(false) 44: 45: -- Ensure userspace interfaces are listed -- 46: bool(true) 47: Done