public function testPropertyValueInterface()
 {
     $adapter = new RuleAdapter(new PropertyIsRequiredRule());
     $result = $adapter->execute('42');
     $this->assertInstanceOf(RuleExecutionResult::class, $result, 'Rule must return RuleExecutionResult object');
     $this->assertTrue($result->isSuccess());
 }
 /**
  * are Transition rules satisfied?
  *
  * @param $newEntityValues
  * @param $oldEntityValues
  * @param Transition $transition
  * @return Transition
  * @throws \dicom\workflow\rules\adapter\exception\RuleAdapterException
  */
 public function executeTransitionRules($newEntityValues, $oldEntityValues = null, Transition $transition = null)
 {
     $transition = null !== $transition ? $transition : $this->createTransition();
     $transition->setTransitionSpecification($this);
     foreach ($this->getRules() as $rule) {
         $adapter = new RuleAdapter($rule);
         $executionResult = $adapter->execute($newEntityValues, $oldEntityValues);
         $transition->addTransitionRuleExecutionResult($executionResult);
     }
     return $transition;
 }
 /**
  * проверяет, что все правила данного свойства удовлетворены
  *
  * @param null|mixed $propertyNewValue новое значение аттрибута (например перед сохранением в базу данных)
  * @param null|mixed $propertyOldValue старое значение аттрибута (например причтении из базы)
  *
  * @return PropertyExecutionResult
  */
 public function executeRules($propertyNewValue = null, $propertyOldValue = null)
 {
     $propertyExecutionResult = new PropertyExecutionResult($this);
     foreach ($this->getRules() as $rule) {
         $adapter = new RuleAdapter($rule);
         $executionResult = $adapter->execute($propertyNewValue, $propertyOldValue);
         $propertyExecutionResult->addRuleExecutionResult($executionResult);
     }
     return $propertyExecutionResult;
 }