gearman_task_002.phpt 931 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. GearmanTask::unique, gearman_task_unique
  3. --SKIPIF--
  4. <?php if (!extension_loaded("gearman")) print "skip";
  5. require_once('skipifconnect.inc');
  6. ?>
  7. --FILE--
  8. <?php
  9. $client = new GearmanClient();
  10. $client->addServer('localhost', 4730);
  11. $task = $client->addTask("GearmanTaskFunction", "normal");
  12. print "GearmanTask::unique (OO): "
  13. . (preg_match('/^(.*)-(.*)-(.*)-(.*)-(.*)$/', $task->unique())
  14. ? 'String matches' : 'String does not match')
  15. . PHP_EOL;
  16. $client2 = gearman_client_create();
  17. gearman_client_add_server($client2, 'localhost', 4730);
  18. $task2 = gearman_client_add_task($client2, "GearmanTaskFunction2", "normal");
  19. print "gearman_client_unique (Procedural): "
  20. . (preg_match('/^(.*)-(.*)-(.*)-(.*)-(.*)$/', gearman_task_unique($task))
  21. ? 'String matches' : 'String does not match')
  22. . PHP_EOL;
  23. print "OK";
  24. ?>
  25. --EXPECT--
  26. GearmanTask::unique (OO): String matches
  27. gearman_client_unique (Procedural): String matches
  28. OK