You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Task_MQ_Redis_Test.php 1.1 KiB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * PhpUnderControl_TaskMQRedis_Test
  4. *
  5. * 针对 ../../MQ/Redis.php Task_MQ_Redis 类的PHPUnit单元测试
  6. *
  7. * @author: Task_MQ_Redis 20150516
  8. */
  9. require_once dirname(__FILE__) . '/../test_env.php';
  10. if (!class_exists('Task_MQ_Redis')) {
  11. require dirname(__FILE__) . '/../../MQ/Redis.php';
  12. }
  13. class PhpUnderControl_TaskMQRedis_Test extends PHPUnit_Framework_TestCase
  14. {
  15. public $taskMQRedis;
  16. protected function setUp()
  17. {
  18. parent::setUp();
  19. $this->taskMQRedis = new Task_MQ_Redis();
  20. }
  21. protected function tearDown()
  22. {
  23. }
  24. /**
  25. * @group testAdd
  26. */
  27. public function testAdd()
  28. {
  29. $service = 'TaskRedis.Test';
  30. $params = array (
  31. 'id' => 1,
  32. );
  33. $rs = $this->taskMQRedis->add($service, $params);
  34. $this->taskMQRedis->add($service, array('id' => 2));
  35. }
  36. /**
  37. * @group testPop
  38. */
  39. public function testPop()
  40. {
  41. $service = 'TaskRedis.Test';
  42. $num = 2;
  43. $rs = $this->taskMQRedis->pop($service, $num);
  44. $this->assertEquals(array(array('id' => 1), array('id' => 2)), $rs);
  45. }
  46. }