Ejemplo n.º 1
0
 /**
  * @param array $aProcessStepDefinition
  * @return ProcessStep
  * @throws \InvalidArgumentException
  */
 public static function processStepFromDefinition(array $aProcessStepDefinition)
 {
     if (isset($aProcessStepDefinition['agent'])) {
         Assertion::isArray($aProcessStepDefinition['agent'], sprintf("The agent property of an ProcessStepDefinition must be an array: %s given in %s", Util::getType($aProcessStepDefinition['agent']), json_encode($aProcessStepDefinition)));
         return ProcessStep::fromAgentDescription(static::agentDescriptionFromDefinition($aProcessStepDefinition['agent']));
     } else {
         if (isset($aProcessStepDefinition['role']) && isset($aProcessStepDefinition['action'])) {
             Assertion::isArray($aProcessStepDefinition['role'], sprintf("The role property of an ProcessStepDefinition must be an array: %s given in %s", Util::getType($aProcessStepDefinition['role']), json_encode($aProcessStepDefinition)));
             Assertion::isArray($aProcessStepDefinition['action'], sprintf("The action property of an ProcessStepDefinition must be an array: %s given in %s", Util::getType($aProcessStepDefinition['action']), json_encode($aProcessStepDefinition)));
             return ProcessStep::fromRoleAndActionDescription(static::roleDescriptionFromDefinition($aProcessStepDefinition['role']), static::actionDescriptionFromDefinition($aProcessStepDefinition['action']));
         } else {
             throw new \InvalidArgumentException('Invalid ProcessStep. Missing agent or role and action properties');
         }
     }
 }
 /**
  * @test
  */
 public function is_not_same_value_with_other_processSteps()
 {
     $agentDescription = new AgentDescription(AgentDescription::LOOP, $this->processStepCollection, new AgentOptions(array('option' => 'value')));
     $otherProcessStepCollection = array(ProcessStep::fromAgentDescription($agentDescription));
     $otherAgentDescription = new AgentDescription(AgentDescription::LOOP, $otherProcessStepCollection, new AgentOptions(array('option' => 'value')));
     $this->assertFalse($agentDescription->sameValueAs($otherAgentDescription));
 }
Ejemplo n.º 3
0
 /**
  * @test
  */
 public function is_not_same_value_as()
 {
     $processStep = ProcessStep::fromRoleAndActionDescription($this->role, $this->actionDescription);
     $otherProcessStep = ProcessStep::fromAgentDescription($this->agentDescription);
     $this->assertFalse($processStep->sameValueAs($otherProcessStep));
 }