TestIndex.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace think;
  3. // 加载基础文件
  4. define('BASE_ROOT_PATH',str_replace('/tests','',dirname(__FILE__)));
  5. define('BASE_PATH',BASE_ROOT_PATH . '/tests');
  6. define('APP_ID','tests');
  7. define('BASE_DATA_PATH',BASE_ROOT_PATH . '/data');
  8. require_once(BASE_ROOT_PATH . '/other/config.ini.php');
  9. require_once(BASE_ROOT_PATH . '/thinkphp/base.php');
  10. require_once(BASE_ROOT_PATH . '/extend/http.php');
  11. require_once(BASE_ROOT_PATH . '/extend/queue.logic.php');
  12. require_once(BASE_ROOT_PATH . '/extend/log.php');
  13. use PHPUnit\Framework\TestCase;
  14. use queue_logic;
  15. class TestIndex extends TestCase
  16. {
  17. protected $baseUrl = 'http://localhost';
  18. public static function setUpBeforeClass() : void
  19. {
  20. App::getInstance()->path(BASE_ROOT_PATH . '/application/')->initialize();
  21. }
  22. public function testCheckOrder()
  23. {
  24. $resp = http_request('http://host.docker.internal:8080/CheckOrder',['order_sn' => '123456'],'GET');
  25. }
  26. public function testInviteBonus()
  27. {
  28. $obj = new \app\index\controller\Index;
  29. $obj->_CheckOrder('123456789');
  30. }
  31. public function testOpenBox()
  32. {
  33. $logic_queue = new queue_logic();
  34. $logic_queue->OpenBox(['cabinet_code' => '0000000000000000','box_position_list' => [1],'delay_time' => 0,
  35. 'req_url' => 'http://221.217.229.194:8888','key' => '12345678','id' => '1234567' ,'ret_queue' => 'test_queue']);
  36. }
  37. public function testQueryBoxState()
  38. {
  39. $logic_queue = new queue_logic();
  40. $logic_queue->QueryBoxState(['cabinet_code' => '0000000000000000','box_position_list' => [1],'delay_time' => 0,
  41. 'req_url' => 'http://221.217.229.194:8888','key' => '12345678','id' => '1234567','ret_queue' => 'test_queue']);
  42. }
  43. public function testUpdateAllBoxState()
  44. {
  45. $logic_queue = new queue_logic();
  46. $logic_queue->UpdateAllBoxState();
  47. }
  48. }