Esempio n. 1
0
 public function testBadEvaluation()
 {
     $badOperator = new \mock\MojoLyon\Axiom\RuleElement\Operator('and');
     $badOperator->getMockController()->__invoke = function () {
         return 'bad thing';
     };
     $rule = new base('ruletest');
     $rule->proposition('test', true)->proposition('test2', true)->proposition('test3', true)->operator('or')->add($badOperator);
     $context = new \MojoLyon\Axiom\Context('ruletest');
     $this->exception(function () use($rule, $context) {
         $rule->evaluate($context);
     })->isInstanceOf('\\LogicException')->hasMessage('Operator must return a proposition');
 }
Esempio n. 2
0
 /**
  * Return if a rule is overriden by a RuleOverride
  *
  * @param Rule $rule Rule to check
  *
  * @return bool
  */
 private function isOverriden(Rule $rule)
 {
     return array_key_exists($rule->getName(), $this->ruleOverride);
 }