/** * parse and add rules to transition specification * * @param array $transitionDescription */ protected function addRulesToTransitionSpecification($transitionDescription) { if (array_key_exists('rules', $transitionDescription)) { $rules = RulesFactory::createBatchByShortNames($transitionDescription['rules']); $this->getTransitionSpecification()->setRules($rules); } }
public function testCreateBatchByShortNames() { $factory = new RulesFactory(); $rules = $factory->createBatchByShortNames(['alwaysTrue', 'alwaysFalse']); $this->assertCount(2, $rules, 'contains only 2 rule'); $this->assertContainsOnlyInstancesOf(IRule::class, $rules, 'contains only Rules'); }
/** * Создать Property содержащее правила * * @param $name * @param $rules * @return Property */ protected static function createLeafProperty($name, $rules) { $property = new Property($name); $property->setRules(RulesFactory::createBatchByShortNames($rules)); return $property; }