コード例 #1
0
 /**
  * @param AbstractAsyncJobObject $job
  * @param int $timeout
  * @param int $interval
  */
 protected function waitTillJobComplete(AbstractAsyncJobObject $job, $timeout = 60, $interval = 2)
 {
     $end = time() + $timeout;
     do {
         if ($job->read()->isComplete()) {
             return;
         }
         sleep($interval);
     } while (time() <= $end);
     $this->markTestSkipped("Async Job timed out. Timeout: {$timeout}, Interval: {$interval}");
 }
コード例 #2
0
 /**
  * @param string $job_class
  * @param array $fields
  * @param array $params
  * @return AbstractAsyncJobObject
  * @throws \InvalidArgumentException
  */
 protected function createAsyncJob($job_class, array $fields = array(), array $params = array())
 {
     $object = new $job_class(null, $this->assureId(), $this->getApi());
     if (!$object instanceof AbstractAsyncJobObject) {
         throw new \InvalidArgumentException("Class {$job_class} is not of type " . AbstractAsyncJobObject::className());
     }
     return $object->setData($fields)->create($params);
 }