gearman_worker_008.phpt 1.2 KB

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. gearman_worker_timeout(), gearman_worker_set_timeout()
  3. --SKIPIF--
  4. <?php if (!extension_loaded("gearman")) print "skip"; ?>
  5. --FILE--
  6. <?php
  7. $timeout = 5;
  8. $worker = new GearmanWorker();
  9. print "GearmanWorker::timeout() (OO, before setting): " . $worker->timeout() . PHP_EOL;
  10. print "GearmanWorker::setTimeout() (OO): " .($worker->setTimeout($timeout) === true ? "Success" : "Failure") . PHP_EOL;
  11. print "GearmanWorker::timeout() (OO, after setting): " . $worker->timeout() . PHP_EOL;
  12. $worker2 = gearman_worker_create();
  13. print "gearman_worker_timeout() (Procedural, before setting): " . gearman_worker_timeout($worker2) . PHP_EOL;
  14. print "gearman_worker_set_timeout() (Procedural): " . (gearman_worker_set_timeout($worker2, $timeout) === true ? "Success" : "Failure") . PHP_EOL;
  15. print "gearman_worker_timeout() (Procedural, after setting): " . gearman_worker_timeout($worker2) . PHP_EOL;
  16. print "OK";
  17. ?>
  18. --EXPECT--
  19. GearmanWorker::timeout() (OO, before setting): -1
  20. GearmanWorker::setTimeout() (OO): Success
  21. GearmanWorker::timeout() (OO, after setting): 5
  22. gearman_worker_timeout() (Procedural, before setting): -1
  23. gearman_worker_set_timeout() (Procedural): Success
  24. gearman_worker_timeout() (Procedural, after setting): 5
  25. OK