gearman_worker_010.phpt 1.0 KB

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. gearman_worker_add_server(), gearman_worker_add_servers()
  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. $worker = new GearmanWorker();
  12. print "GearmanWorker::addServer() (OO):" . ($worker->addServer($host, $port) === true ? "Success" : "Failure").PHP_EOL;
  13. print "GearmanWorker::addServers() (OO): " . ($worker->addServers("$host:$port") === true ? "Success" : "Failure").PHP_EOL;
  14. $worker2 = gearman_worker_create();
  15. print "gearman_worker_add_server() (Procedural): " . (gearman_worker_add_server($worker, $host, $port) === true ? "Success" : "Failure").PHP_EOL;
  16. print "gearman_worker_add_servers() (Procedural): " . (gearman_worker_add_servers($worker, "$host:$port") === true ? "Success" : "Failure").PHP_EOL;
  17. print "OK";
  18. ?>
  19. --EXPECT--
  20. GearmanWorker::addServer() (OO):Success
  21. GearmanWorker::addServers() (OO): Success
  22. gearman_worker_add_server() (Procedural): Success
  23. gearman_worker_add_servers() (Procedural): Success
  24. OK