function test_add9_hook($t) { $result = "FAIL"; $app = new ApiCLI(); $app->addHook('beforeObjectInit', function () use(&$result) { $result = "OK"; }); $t = $app->add('MyObject'); return $result; }