El siguiente código funciona bien.Cómo usar call_user_func para el método de clase estática?
LibraryTests::TestGetServer();
Obtener la matriz de funciones en LibraryTests y ejecutarlos:
$methods = get_class_methods('LibraryTests');
foreach ($methods as $method) {
call_user_func('LibraryTests::' . $method . '()');
}
Esto arroja un error: Warning: call_user_func(LibraryTests::TestGetServer()) [function.call-user-func]: First argument is expected to be a valid callback
Aquí es la clase que se está llamando:
class LibraryTests extends TestUnit {
function TestGetServer() {
TestUnit::AssertEqual(GetServer(), "localhost/");
}
.
.
.
¿Cómo solucionarlo?
Trabajando en PHP 5.2.8.
No agregue '()' si la función no tiene parámetros – m13r