1--TEST-- 2Test get_class_methods() function : basic functionality 3--FILE-- 4<?php 5/* 6 * Test basic behaviour with existing class and non-existent class. 7 */ 8 9echo "*** Testing get_class_methods() : basic functionality ***\n"; 10 11class C { 12 function f() {} 13 function g() {} 14 function h() {} 15} 16 17echo "Argument is class name:\n"; 18var_dump( get_class_methods("C") ); 19echo "Argument is class instance:\n"; 20$c = new C; 21var_dump( get_class_methods($c) ); 22 23class D {} 24echo "Argument is name of class which has no methods:\n"; 25var_dump( get_class_methods("D") ); 26 27echo "Argument is non existent class:\n"; 28try { 29 var_dump( get_class_methods("NonExistent") ); 30} catch (TypeError $exception) { 31 echo $exception->getMessage() . "\n"; 32} 33 34echo "Done"; 35?> 36--EXPECT-- 37*** Testing get_class_methods() : basic functionality *** 38Argument is class name: 39array(3) { 40 [0]=> 41 string(1) "f" 42 [1]=> 43 string(1) "g" 44 [2]=> 45 string(1) "h" 46} 47Argument is class instance: 48array(3) { 49 [0]=> 50 string(1) "f" 51 [1]=> 52 string(1) "g" 53 [2]=> 54 string(1) "h" 55} 56Argument is name of class which has no methods: 57array(0) { 58} 59Argument is non existent class: 60get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, string given 61Done 62