TestFcgi.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. use PHPUnit\Framework\TestCase;
  3. define('APP_ID', 'test');
  4. define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
  5. require_once(BASE_ROOT_PATH . '/global.php');
  6. require_once(BASE_CORE_PATH . '/lrlz.php');
  7. require_once(BASE_ROOT_PATH . '/fooder.php');
  8. require_once(BASE_CORE_PATH . '/framework/function/http.php');
  9. require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
  10. require_once(BASE_HELPER_PATH . '/mtopcard/mtopcard.php');
  11. class TestFcgi extends TestCase
  12. {
  13. public static function setUpBeforeClass() : void
  14. {
  15. Base::run_util();
  16. }
  17. public function testEcho()
  18. {
  19. $phone = '13911129867';
  20. $amount = 100;
  21. $url = 'http://host.docker.internal' . "/mobile/index.php";
  22. $params = ['mchid' => 1,
  23. 'cardno' => $phone,
  24. 'amount' => $amount,
  25. "act" => "refill",
  26. "op" => "add",
  27. 'order_sn' => $this->make_sn(),
  28. 'notifyurl' => "http://www.baidu.com"];
  29. $proxy = new refill_proxy("1ff02223b771c0414468c8892151c602");
  30. while (true) {
  31. $resp = $proxy->send($url, $params);
  32. }
  33. }
  34. private function make_sn()
  35. {
  36. return mt_rand(1000, 9999)
  37. . sprintf('%010d', time())
  38. . sprintf('%06d', (float)microtime() * 1000000);
  39. }
  40. public function testMicroTime()
  41. {
  42. [$micro,$time] = explode(' ',microtime());
  43. }
  44. }