/** * Methods needed * * register rule - add a single rule object or an array of rules * register files - add all rules in a directory * register all - register all rules that have been autoloaded * * create rule - Dynamically create a rule object * * evaluate - apply all the rules and return the results * */ public function createRule($name, $checkFunc) { $rule = new \Sgrover\Rules\Rule(); $rule->setName($name); $rule->setCallback($checkFunc); $this->rules[] = $rule; }
public function testSetRunCallback() { $rule = new \Sgrover\Rules\Rule(); $rule->setCallback(function () { return 2; }); $this->assertEquals($rule->evaluate(), 2); }