123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <?php
- use PHPUnit\Framework\TestCase;
- define('APP_ID', 'test');
- define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
- require_once(BASE_ROOT_PATH . '/global.php');
- require_once(BASE_CORE_PATH . '/lrlz.php');
- require_once(BASE_ROOT_PATH . '/fooder.php');
- require_once(BASE_CORE_PATH . '/framework/function/http.php');
- require_once(BASE_HELPER_PATH . '/refill_proxy.php');
- class TestHttp extends TestCase
- {
- public static function setUpBeforeClass(): void
- {
- Base::run_util();
- }
- public function testRequest()
- {
- Log::record(__METHOD__,Log::DEBUG);
- for ($i = 0; $i < 10000; $i++) {
- $rsp = http_request("https://test.xyzshops.cn");
- }
- }
- public function testIPS()
- {
- $ins = Cache::getInstance('cacheredis');
- $ins->hdel('', '', '');
- $x = 'a:2:{i:0;s:14:"222.129.49.232";i:1;s:14:"222.129.55.246";}';
- $x = unserialize($x);
- $x[] = '';
- }
- public function testRefillAdd()
- {
- $time = time() * 10;
- for ($i = 0;$i < 2; $i++) {
- $this->push_order(1092, $time, $i);
- }
- }
- private function push_order($mchid,$time,$index)
- {
- $notify_url = "https://test.xyzshops.cn/mobile/callback/bridge_test.php";
- $params = [ 'mchid' => $mchid,
- 'amount' => 30,
- 'order_sn' => "{$time}" . sprintf("%'010d",$index),
- 'cardno' => '13911129867',
- "act" => "refill",
- "op" => "add",
- 'notifyurl' => $notify_url
- ];
- $proxy = new refill_proxy("210fe406954220f56085997d6a4c5b80");
- $resp = $proxy->send("https://test.xyzshops.cn/mobile/index.php", $params);
- }
- public function testBase64()
- {
- $data = 'VzaryoW5iSWFZq/JyBD/wk1rW9gFxQgGwj6o2aikRRnQ3Zb/1VQ1uY37VMB9FMXg8QV3O2a+ElSxXdelNrtO6UHUwP8VMrWIYHiL9kh3w7Bhel6iBSfVAkd02pUJz433UxqNddGYllzd3DxFaySzlL5nzQwZU/8FgXX0QC3EJCuUUCPXqJnvg/sJzGXpEyt07mjGHsUusUo68HDpI+im8vb5n2SCIChABS2u5SSUF7iTtVpOPD14mc106JsEzivCBANYgwCZyDOV32nqgFmO9t4zJVI4gvUl8uya5Z9A4Q2oGrMP6DA7q14RsEBSq8sPPNDlN0AebSVnJ3krWsLTQLZ/fQgQH0diZ7oPOKEHLxdPAA9tRsIAdrdBOEAIvuuvbZiuf5a7PolcuNCJTGTgJnmOpcUpxF9tvax6ZA2X+9nFlgA1nh+Ev6wbGVwlssvQrup/PIFbVPCIVDd4jM+Vkg9y0cK/H07m+GdwytbY9dLYUzjiPXK913LZbAjL7tDfX3ELCvA10xr+CMWsM8MwrzHq5EYNIDZawke3T3rGxhi2iQ8reXx3SmJvRwg6BDQK';
- $y = base64_decode($data);
- }
- public function testRetparams()
- {
- $fun = function ($input) {
- if($input == 1) {
- return ['a','b',$input];
- }
- else {
- return ['a','b',$input,'c'];
- }
- };
- $val = $fun (1);
- if(count($val) == 3) {
- [$x,$y,$z] = $val;
- } else {
- [$x,$y,$z,$a] = $val;
- }
- }
- public function testGoods()
- {
- // $params = [ 'mchid' => 10384,
- // "op" => "goods",
- // 'act' => 'refill'
- // ];
- //$resp = $proxy->send("https://www.xyzshops.cn/mobile/index.php", $params);
- $params = [ 'mchid' => 10384,
- "op" => "goods",
- 'act' => 'refill'
- ];
- $proxy = new refill_proxy("682240597a865cfba5214a0c8477bd76");
- $resp = $proxy->send("https://ylapi.xyzshops.cn/mobile/index.php", $params);
- }
- }
|