Ejemplo n.º 1
0
 /**
  * @return array
  */
 public function initFromArrayDataProvider()
 {
     $fixture = json_decode($this->loadFixture(static::FILE_FIXTURE), true);
     $expectation = new DecisionResult();
     $decision = new Decision();
     $decision->initFromArray($fixture[DecisionResult::INDEX_DECISIONS][0]);
     $expectation->setTaskToken('AAAAKgAAAAEAAAAAAAAAAQLPoqDSLcx4ksNCEQZCyEBqpKhE');
     $expectation->setExecutionContext('Black Friday');
     $expectation->setDecisions(array($decision));
     return array(array('success' => array(static::INDEX_INPUT => $fixture, static::INDEX_EXPECTATION => $expectation)));
 }
Ejemplo n.º 2
0
 /**
  * @param array $source
  * @return mixed
  */
 public function initFromArray(array $source)
 {
     $this->taskToken = $source[static::INDEX_TASK_TOKEN];
     $this->executionContext = $source[static::INDEX_EXECUTION_CONTEXT];
     $decisions = array();
     foreach ($source[static::INDEX_DECISIONS] as $item) {
         $decision = new Decision();
         $decision->initFromArray($item);
         $decisions[] = $decision;
     }
     $this->decisions = $decisions;
 }