流明的phpunit测试5.5.2不能使用Request类获取json数据

时间:2018-04-08 13:57:56

标签: php laravel phpunit lumen

我使用lumen 5.5.2,我想为它创建http测试。所以我使用了这段代码:

class ExampleTest extends \TestCase
{
    public function testExample()
    {
        $header = [
         'access-token'  => '$2y$10$Z6PvDMkTVVaSQJD10YGEsOz6E2KdQ2Q9RKo7roanZIAwRz0thUoAS',
         'refresh-token' => '$2y$10$WA12Phc979GKN9xht89Fv.RSeaS/R4MErWTjLYY1mNC8vS03E84XC',
         'app-name'      => 'test',
         'app-secret'    => 'test',
         'Content-Type'  => 'application/json'
        ];

        $json=[
         "gdata"=>[
          "title"=>"testTitle",
          "slug"=>"testSlug",
          "tag"=>"testTag",
          "scope"=>1
         ]
        ];
        $this->json('POST', '/settings/gdata/create', $json, $header)->seeJson([ 'status' => true ]);
    }
}

但我无法通过流明$json获取Request数据,当我得到它时,它是空的。

0 个答案:

没有答案