protected function setUp()
 {
     $this->role = new RoleDescription(new RoleName('Testrole'));
     $this->actionDescription = ActionDescription::asQuery(new Name('testaction'));
     $this->processStepCollection = array(ProcessStep::fromRoleAndActionDescription($this->role, $this->actionDescription));
 }
 /**
  * @test
  */
 public function is_not_same_value_as_when_only_other_has_structure_description()
 {
     $eventsDefinition = EventsDefinition::fromEventDescriptionDefinitions(array('CommandTriggered' => array('success' => 'boolean')));
     $actionDescription = ActionDescription::asCommand(new Name('Testaction'), $eventsDefinition, new Arguments(array('foo' => 'bar')));
     $otherActionDescription = ActionDescription::asCommand(new Name('Testaction'), $eventsDefinition, new Arguments(array('foo' => 'bar')), StructureDefinition::fromPathValueTypeList(array('a' => StructureDefinition::STRING)));
     $this->assertFalse($actionDescription->sameValueAs($otherActionDescription));
 }
 /**
  * @param array $anActionDescriptionDefinition
  * @return ActionDescription
  */
 public static function actionDescriptionFromDefinition(array $anActionDescriptionDefinition)
 {
     Assertion::keyExists($anActionDescriptionDefinition, 'name', sprintf("Missing name property in ActionDescriptionDefinition: %s", json_encode($anActionDescriptionDefinition)));
     Assertion::keyExists($anActionDescriptionDefinition, 'type', sprintf("Missing type property in ActionDescriptionDefinition: %s", json_encode($anActionDescriptionDefinition)));
     if ($anActionDescriptionDefinition['type'] === Type::COMMAND) {
         Assertion::keyExists($anActionDescriptionDefinition, 'events', sprintf("Missing events property in ActionDescriptionDefinition: %s", json_encode($anActionDescriptionDefinition)));
         $eventsDefinition = EventsDefinition::fromEventDescriptionDefinitions($anActionDescriptionDefinition['events']);
     } else {
         $eventsDefinition = null;
     }
     if (isset($anActionDescriptionDefinition['arguments'])) {
         Assertion::isArray($anActionDescriptionDefinition['arguments'], sprintf("The arguments property of ActionDescriptionDefinition must be an array: %s given in %s", Util::getType($anActionDescriptionDefinition['arguments']), json_encode($anActionDescriptionDefinition)));
         $arguments = new Arguments($anActionDescriptionDefinition['arguments']);
     } else {
         $arguments = new Arguments(array());
     }
     if (isset($anActionDescriptionDefinition['structure'])) {
         Assertion::isArray($anActionDescriptionDefinition['structure'], sprintf("The structure property of ActionDescriptionDefinition must be an array: %s given in %s", Util::getType($anActionDescriptionDefinition['structure']), json_encode($anActionDescriptionDefinition)));
         $structureDefinition = StructureDefinition::fromPathValueTypeList($anActionDescriptionDefinition['structure']);
     } else {
         $structureDefinition = null;
     }
     if ($anActionDescriptionDefinition['type'] === Type::COMMAND) {
         return ActionDescription::asCommand(new Name($anActionDescriptionDefinition['name']), $eventsDefinition, $arguments, $structureDefinition);
     } else {
         return ActionDescription::asQuery(new Name($anActionDescriptionDefinition['name']), $arguments, $structureDefinition);
     }
 }