public function testEvaluateFalseWithRuleoverride() { $rule = new \MojoLyon\Axiom\Rule('test'); $rule->proposition('test', true); $rule2 = new \MojoLyon\Axiom\Rule('test2'); $rule2->proposition('test2', true); $context = new \MojoLyon\Axiom\Context('test'); $context->proposition('test', true); $context->proposition('test2', true); $ruleoverride = new \MojoLyon\Axiom\RuleOverride('test', false); $base = new base('testruleset'); $base->addRule($rule); $base->addRule($rule2); $base->addRuleOverride($ruleoverride); $this->object($proposition = $base->evaluate($context))->isInstanceOf('\\MojoLyon\\Axiom\\RuleElement\\Proposition')->string($proposition->getName())->isEqualTo('testruleset')->boolean($proposition->getValue())->isFalse(); }
public function testEvaluateBadContext() { $rule = new base('ruletest'); $rule->proposition('test', true)->variable('test2', 'test2'); $context = new \MojoLyon\Axiom\Context('ruletest'); $context->proposition('test', false)->proposition('test2', true); $this->exception(function () use($rule, $context) { $rule->evaluate($context); })->isInstanceOf('\\UnexpectedValueException'); }