gearman_client_007.phpt 1.2 KB

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. GearmanClient::addOptions(), gearman_client_add_options()
  3. --SKIPIF--
  4. <?php if (!extension_loaded("gearman")) print "skip"; ?>
  5. --FILE--
  6. <?php
  7. $client = new GearmanClient();
  8. $client->setOptions(GEARMAN_CLIENT_NON_BLOCKING);
  9. print "GearmanClient::options (OO): " . $client->options() . PHP_EOL;
  10. print "GearmanClient::addOptions (OO): " . ($client->addOptions(GEARMAN_CLIENT_FREE_TASKS) ? 'Success' : 'Failure') . PHP_EOL;
  11. print "GearmanClient::options (OO): " . $client->options() . PHP_EOL;
  12. $client2 = gearman_client_create();
  13. gearman_client_set_options($client2, GEARMAN_CLIENT_NON_BLOCKING);
  14. print "gearman_client_options (Procedural): " . gearman_client_options($client2) . PHP_EOL;
  15. print "gearman_client_add_options (Procedural): " . (gearman_client_add_options($client2, GEARMAN_CLIENT_FREE_TASKS) ? 'Success' : 'Failure') . PHP_EOL;
  16. print "gearman_client_options (Procedural): " . gearman_client_options($client2) . PHP_EOL;
  17. print "OK";
  18. ?>
  19. --EXPECT--
  20. GearmanClient::options (OO): 2
  21. GearmanClient::addOptions (OO): Success
  22. GearmanClient::options (OO): 34
  23. gearman_client_options (Procedural): 2
  24. gearman_client_add_options (Procedural): Success
  25. gearman_client_options (Procedural): 34
  26. OK