function other_class($t) { $obj = new TestClass(); $other = new OtherClass(); $obj->register_hook(); $other->register_hook(); $r = $obj->run_hook(3); $t->is($r, 13.5); $obj->clear_hook(); $other->clear_hook(); }