Codeception 相对较新,并试图将其连接到 Slim 3。为 POST 请求设置基本测试,如下所示:
$I->sendPOST('/user', [
'details' => [
'id' => 0,
'package_id' => 0,
'order_id' => 0
]
]);
在路线本身上,我使用 Slim 3 的 getParam 来获取我发送的详细信息,如下所示:
$details = $request->getParam('details', []);
通过 --debug 运行测试,我看到请求有{"details":{"package_id":0,"order_id":0}
但是,似乎 getParam 的详细信息没有返回任何内容。我试过在细节之外单独发送它们,但无济于事。
此时,想知道我通过 Codeception 的 sendPOST 和 Slim 3 的 getParam 发送的详细信息之间是否存在 PSR-7 兼容性问题,因为 Slim 的 getParam 方法带有以下注释:
* Fetch request parameter value from body or query string (in that order).
*
* Note: This method is not part of the PSR-7 standard.
任何帮助表示赞赏!