所以我在/ test目录中创建了一个测试类 在testExample函数中,我将输入和输出JSON字符串存储到变量中。
使用输入和输出字符串转换为数组 json_decode(inputstring,true); json_decode(outputstring,true);
我用过以下来测试这个API
$this->json('POST', 'api/v1/tagging', $input, ['Content-Type' => 'application/json'])
->seeJson([
'conversion_specs' => ["post_engagement"],
]);
其中conversion_specs:["post_engagement"]
是输出json
我怎么能断言它并且在击中后打印太多数据
./vendor/bin/phpunit
命令
我认为它出了问题,任何人都可以帮我检查具有预期价值的API。