lundi 29 août 2016

Is it possible to get the reflection of the recursive private static method?

I have some class

class Test {
    static private function someFunc(&$item) {
        $order = 0;
        foreach($item as &$folder) {
            $_folder['order'] = $order;
            $order += 1;
            if (isset($folder['value'])) {
                 static::someFunc($folder['value']);
            }
        }
    }
}

and I need to get reflection of this class for unit test

$func = new ReflectionMethod('Test', 'someFunc');
$func->setAccessible(true);

But what to do with the recursion? Is this possible change this line:

static::someFunc($folder['value']);





Aucun commentaire:

Enregistrer un commentaire