gearman_worker_015.phpt 704 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. gearman_worker_ping()
  3. --SKIPIF--
  4. <?php if (!extension_loaded("gearman")) print "skip";
  5. require_once('skipifconnect.inc');
  6. ?>
  7. --FILE--
  8. <?php
  9. $host = 'localhost';
  10. $port = 4730;
  11. $json_workload = '{"workload":"test"}';
  12. $worker = new GearmanWorker();
  13. $worker->addServer($host, $port);
  14. echo "GearmanWorker::server() (OO): ".($worker->ping($json_workload) ? "Success" : "Failure").PHP_EOL;
  15. $worker2 = gearman_worker_create();
  16. gearman_worker_add_server($worker, $host, $port);
  17. echo "gearman_worker_work() (Procedural): ".($worker->ping($json_workload) ? "Success" : "Failure").PHP_EOL;
  18. print "OK";
  19. ?>
  20. --EXPECT--
  21. GearmanWorker::server() (OO): Success
  22. gearman_worker_work() (Procedural): Success
  23. OK