Return to get_class_methods_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_class_methods() function : basic functionality 3: --FILE-- 4: <?php 5: /* Prototype : proto array get_class_methods(mixed class) 6: * Description: Returns an array of method names for class or class instance. 7: * Source code: Zend/zend_builtin_functions.c 8: * Alias to functions: 9: */ 10: 11: /* 12: * Test basic behaviour with existing class and non-existent class. 13: */ 14: 15: echo "*** Testing get_class_methods() : basic functionality ***\n"; 16: 17: class C { 18: function f() {} 19: function g() {} 20: function h() {} 21: } 22: 23: echo "Argument is class name:\n"; 24: var_dump( get_class_methods("C") ); 25: echo "Argument is class instance:\n"; 26: $c = new C; 27: var_dump( get_class_methods($c) ); 28: 29: class D {} 30: echo "Argument is name of class which has no methods:\n"; 31: var_dump( get_class_methods("D") ); 32: 33: echo "Argument is non existent class:\n"; 34: var_dump( get_class_methods("NonExistent") ); 35: 36: echo "Done"; 37: ?> 38: --EXPECTF-- 39: *** Testing get_class_methods() : basic functionality *** 40: Argument is class name: 41: array(3) { 42: [0]=> 43: string(1) "f" 44: [1]=> 45: string(1) "g" 46: [2]=> 47: string(1) "h" 48: } 49: Argument is class instance: 50: array(3) { 51: [0]=> 52: string(1) "f" 53: [1]=> 54: string(1) "g" 55: [2]=> 56: string(1) "h" 57: } 58: Argument is name of class which has no methods: 59: array(0) { 60: } 61: Argument is non existent class: 62: NULL 63: Done