/** * Return a rule base on it's name * * @param $ruleName * * @throws RuleNotFoundException * * @return callable */ public function getRule($ruleName) { if (parent::hasRule($ruleName)) { return parent::getRule($ruleName); } if (!$this->hasRule($ruleName)) { throw new RuleNotFoundException(RuleNotFoundException::formatMessage($ruleName)); } return $this->container->get($this->ruleServiceMapping[$ruleName]); }
public function testExceptionOnAllMatches() { $this->setExpectedException('Nucleus\\BusinessRuleEngine\\RuleNotFoundException', RuleNotFoundException::formatMessage('notExistingRule')); $this->businessRuleEngine->getAllMatches(array('notExistingRule')); }