| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- namespace Tests\Services\LogisticYDService;
- use App\OrderPackage;
- use App\Services\LogisticYDService;
- use Illuminate\Support\Facades\Http;
- use Tests\TestCase;
- class RegisterApiTest extends TestCase
- {
- /**
- * @var $service LogisticYDService
- */
- private $service;
- protected function setUp(): void
- {
- parent::setUp(); // TODO: Change the autogenerated stub
- $this->service = app('LogisticYDService');
- }
- /**
- * @test
- */
- public function registerApiTest()
- {
- // $this->app_key = config('api_logistic.YD.test.app-key', '999999');
- // $this->app_secret = config('api_logistic.YD.test.app-secret', '04d4ad40eeec11e9bad2d962f53dda9d');
- // $this->url = config('api_logistic.YD.test.register.url');
- // $body = [
- // "orders" => [
- // [
- // "orderid" => "9987765544332",
- // "mailno" => "3309876541228",
- // "receiver" => [
- // "address" => "青浦区盈港东路6679号",
- // "city" => "上海市",
- // "county" => "青浦区",
- // "mobile" => "0553-9876542",
- // "name" => "李四",
- // "phone" => 17601205970,
- // "province" => "上海市"
- // ],
- // "sender" => [
- // "address" => "盈港东路 7766 号",
- // "city" => "上海市",
- // "county" => "青浦区",
- // "mobile" => "0553-9876542",
- // "name" => "张三",
- // "phone" => 17601205970,
- // "province" => "上海市"
- // ],
- // ],
- // ]
- // ];
- // $sign = md5(json_encode($body, JSON_UNESCAPED_UNICODE) . '_' . $this->app_secret);
- // $headers = [
- // 'app-key' => $this->app_key,
- // 'sign' => $sign,
- // 'req-time' => now()->timestamp,
- // "Content-Type" => "application/json"
- // ];
- // $response = Http::withHeaders($headers)->withBody(json_encode($body,JSON_UNESCAPED_UNICODE),'application/json')->post($this->url);
- // $this->assertNotEmpty($response);
- $this->assertTrue(true);
- }
- /**
- * @test
- */
- // public function registerApiTest2()
- // {
- // $this->service->registerApi(['75464485214976','75464484634676']);
- // }
- /**
- * @test
- */
- // public function prod_test()
- // {
- // $result = $this->service->registerApi(['4314519335027']);
- // $this->assertEquals('0000', $result->code);
- // }
- }
|