Exemplo n.º 1
0
 /**
  * Test that all known task types are not supported.
  *
  * @param Task $task The task to test.
  *
  * @return void
  *
  * @dataProvider supportedTaskTypesProvider
  */
 public function testDoesSupportKnown(Task $task)
 {
     $factory = new ComposerTaskFactory(new HomePathDeterminator($this->getTempDir()));
     $this->assertTrue($factory->isTypeSupported($task->getType()), 'Task unsupported in factory: ' . $task->getType());
 }
Exemplo n.º 2
0
 /**
  * Convert a task to an array.
  *
  * @param Task $task         The task to convert.
  *
  * @param bool $addOutput    Flag determining if the output shall get added or not.
  *
  * @param null $outputOffset The output offset to use.
  *
  * @return array
  */
 private function convertTaskToArray(Task $task, $addOutput = false, $outputOffset = null)
 {
     $data = ['id' => $task->getId(), 'status' => $task->getStatus(), 'type' => $task->getType(), 'created_at' => $task->getCreatedAt()->format(\DateTime::ISO8601), 'user_data' => $task->getUserData()];
     if (true === $addOutput) {
         $data['output'] = $task->getOutput($outputOffset);
     }
     return $data;
 }