Browse Source

修复测试用例

Signed-off-by: Gorden Freeman <endoffight@gmail.com>
Gorden Freeman 6 năm trước cách đây
mục cha
commit
14f9da9caf
1 tập tin đã thay đổi với 10 bổ sung8 xóa
  1. 10 8
      test/TestTaobaoApi.php

+ 10 - 8
test/TestTaobaoApi.php

@@ -22,31 +22,33 @@ class TestTaobaoApi extends PHPUnit_Framework_TestCase
 
     public function testApi()
     {
-
         $jsonData = '{"mobile":"15038530312"}';
         $appkey = "90158432354";
         $appSecurity = "620054871918";
         $method = 'business.request.MixMobileRequest';
-        $post_data = [
+        $post_data = http_build_query([
             'jsonData' => $jsonData,
             'apiMethod' => $method
-        ];
+        ]);
         $auth = md5(implode(':', [
             $appkey,
             $appSecurity,
             3000,
             $jsonData
         ]));
+
         $headers = [
-            "appkey: {$appkey}",
-            'Content-Type: application/x-www-form-urlencoded; charset=utf-8',
-            "Authorization: {$auth}",
-            'timestamp : 3000'
+            "appkey:{$appkey}",
+            'Content-Type:application/x-www-form-urlencoded',
+            "Authorization:{$auth}",
+            'timestamp:3000'
         ];
+
         $url = 'https://ssotest.lrlz.com/lrlz-auth/remote/router';
 
-        $server_output = http_request($url, $post_data, 'POST', false, $headers);
+        $server_output = http_post_data($url, $post_data, $headers);
         $server_output = json_decode($server_output, 1);
+
         $obj = '$150$RdVJUoG50MmyXtz2eww9jA==$1$';
         $this->assertEquals($server_output['render']['obj'], $obj);
     }