12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?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_HELPER_PATH . '/mtopcard/mtopcard.php');
- require_once(BASE_HELPER_PATH . '/refill_proxy.php');
- require_once(BASE_CORE_PATH . '/framework/function/http.php');
- class TestElectric extends TestCase
- {
- public static function setUpBeforeClass() : void
- {
- Base::run_util();
- }
- public function testCardid()
- {
- $card_id = '051818';
- $succ = mtopcard\is_alpha($card_id);
- }
- public function testAddElectric()
- {
- $params = [ 'mchid' => 1092,
- "act" => "refill",
- "op" => "add_electric",
- 'order_sn' => $this->make_sn(),
- 'notifyurl' => 'https://www.xyzshops.cn' . '/mobile/innercb.php',
- 'cardno' => '1004638637',
- 'amount' => 200,
- 'company_type' => 'nation',
- 'use_type' => 'home',
- 'card_id' => '051818',
- 'province' => 1,
- 'city' => '北京市'
- ];
- $proxy = new refill_proxy('210fe406954220f56085997d6a4c5b80');
- // $proxy->send(BASE_SITE_URL . "/mobile/index.php",$params);
- $proxy->send('https://www.xyzshops.cn' . "/mobile/index.php",$params);
- }
- public function testNet()
- {
- $params = [ 'mchid' => 1092,
- "act" => "refill",
- "op" => "add_electric",
- 'order_sn' => $this->make_sn(),
- 'notifyurl' => 'https://www.xyzshops.cn/mobile/signature.php',
- 'cardno' => '1004638637',
- 'amount' => 100,
- 'company_type' => 'south',
- 'use_type' => 'home',
- 'card_id' => '051818',
- 'province' => 1
- ];
- $x = http_request(BASE_SITE_URL . "/mobile/index.php",$params);
- }
- private function make_sn()
- {
- return mt_rand(1000, 9999)
- . sprintf('%010d', time())
- . sprintf('%06d', (float)microtime() * 1000000);
- }
- }
|