Exemplo n.º 1
0
 /**
  * @test
  */
 public function execute()
 {
     $task = new Task(function ($arg) {
         return 'foo' . $arg;
     }, 'bar', null);
     $this->assertInstanceOf('\\Ackintosh\\Snidel\\Result\\Result', $task->execute());
 }
Exemplo n.º 2
0
 /**
  * @param   string  $serializedTask
  * @return  \Ackintosh\Snidel\TaskInterface
  */
 public static function unserialize($serializedTask)
 {
     $task = unserialize($serializedTask);
     if (self::isClosure($callable = $task->getCallable())) {
         $task = new Task($callable->getClosure(), $task->getArgs(), $task->getTag());
     }
     return $task;
 }
Exemplo n.º 3
0
 /**
  * @return  void
  * @throws  \RuntimeException
  */
 public function run()
 {
     try {
         $result = $this->task->execute();
     } catch (\RuntimeException $e) {
         throw $e;
     }
     $result->setFork($this->fork);
     try {
         $this->resultQueue->enqueue($result);
     } catch (\RuntimeException $e) {
         throw $e;
     }
 }