public function pollForDecisionTaskDataProvider() { $request = json_decode($this->loadFixture(static::FIXTURE_DECISION_POLL_REQUEST), true); $response = json_decode($this->loadFixture(static::FIXTURE_DECISION_POLL_RESPONSE), true); $taskList = new TaskList(); $taskList->setName('taskListName'); $input = new DecisionPollRequest(); $input->setTaskList($taskList); $input->setIdentity('identityValue'); $input->setDomain('domainName'); $input->setMaximumPageSize(5); $input->setNextPageToken('nextTokenValue'); $input->setReverseOrder(false); $workflowType = new WorkflowType(); $workflowType->setName('customerOrderWorkflow'); $workflowType->setVersion('1.0'); $workflowType->setIsEmpty(false); $workflowExecution = new WorkflowExecution(); $workflowExecution->setRunId('06b8f87a-24b3-40b6-9ceb-9676f28e9493'); $workflowExecution->setWorkflowId('20110927-T-1'); $workflowExecution->setIsEmpty(false); $events = array(); foreach ($response[Event::INDEX_EVENTS] as $evt) { $event = new Event(); $event->initFromArray($evt); $events[] = $event; } $expectation = new DecisionTask(); $expectation->setTaskToken('taskTokenValue'); $expectation->setNextPageToken('nextPageTokenValue'); $expectation->setPreviousStartedEventId(0); $expectation->setWorkflowType($workflowType); $expectation->setWorkflowExecution($workflowExecution); $expectation->setStartedEventId(3); $expectation->setEvents($events); return array(array('success' => array(static::INDEX_INPUT => $input, static::INDEX_SWF_CLIENT_REQUEST_MOCK => $request, static::INDEX_SWF_CLIENT_RESPONSE_MOCK => $response, static::INDEX_EXPECTATION => $expectation))); }
/** * @param array $source * @return mixed */ public function initFromArray(array $source) { foreach ($source[static::INDEX_EVENTS] as $e) { $event = new Event(); $event->initFromArray($e); $this->events[] = $event; } $this->workflowExecution = new WorkflowExecution(); $this->workflowExecution->initFromArray($source); $this->workflowType = new WorkflowType(); $this->workflowType->initFromArray($source); $this->taskToken = $source[static::INDEX_TASK_TOKEN]; $this->nextPageToken = $source[static::INDEX_NEXT_PAGE_TOKEN]; $this->startedEventId = $source[static::INDEX_STARTED_EVENT_ID]; $this->previousStartedEventId = $source[static::INDEX_PREVIOUS_STARTED_EVENT]; }
public function initFromArrayDataProvider() { $inputDecisionScheduled = json_decode($this->loadFixture(static::FILE_FIXTURE_DECISION_SCHEDULED), true); $inputDecisionStarted = json_decode($this->loadFixture(static::FILE_FIXTURE_DECISION_STARTED), true); $inputDecisionCompleted = json_decode($this->loadFixture(static::FILE_FIXTURE_DECISION_COMPLETED), true); $expectation = new Event(); $attributesDecisionScheduled = new DecisionTaskScheduledEventAttributes(); $attributesDecisionScheduled->initFromArray($inputDecisionScheduled); $attributesDecisionStarted = new DecisionTaskStartedEventAttributes(); $attributesDecisionStarted->initFromArray($inputDecisionStarted); $expectation->setActivityTaskScheduledEventAttributes(new ActivityTaskScheduledEventAttributes()); $expectation->setActivityTaskStartedEventAttributes(new ActivityTaskStartedEventAttributes()); $expectation->setActivityTaskCompletedEventAttributes(new ActivityTaskCompletedEventAttributes()); $expectation->setDecisionTaskCompletedEventAttributes(new DecisionTaskCompletedEventAttributes()); $expectation->setDecisionTaskStartedEventAttributes($attributesDecisionStarted); $expectation->setDecisionTaskScheduledEventAttributes($attributesDecisionScheduled); $expectation->setEventId(2); $expectation->setEventTimestamp('2015-10-27T10:57:11+00:00'); $expectation->setEventType('DecisionTaskScheduled'); $expectation->setIsEmpty(false); return array(array('decision-task-scheduled-mock' => array(static::INDEX_INPUT => $inputDecisionScheduled, static::INDEX_EXPECTATION => $expectation), 'decision-task-started-mock' => array(static::INDEX_INPUT => $inputDecisionStarted, static::INDEX_EXPECTATION => $expectation))); }