0
我試圖在我的測試中模擬ajax樣式上傳文件。是否可以使用sendPUT
發送文件並返回響應?控制器通過Input::file()
接收值 - 我似乎無法訪問sendPUT
通過Input::file
發送的值。Codeception sendPUT類型爲輸入::文件
$I->sendPUT('/upload_image', array('file' => 'files.jpg'));
我試圖在我的測試中模擬ajax樣式上傳文件。是否可以使用sendPUT
發送文件並返回響應?控制器通過Input::file()
接收值 - 我似乎無法訪問sendPUT
通過Input::file
發送的值。Codeception sendPUT類型爲輸入::文件
$I->sendPUT('/upload_image', array('file' => 'files.jpg'));
您沒有正確使用此功能。
一切都在official documentation解釋:
sendPUT
發送PUT
請求到給定的URI。
param
$網址param array
$ PARAMSparam array
$文件第三個參數是你在找什麼。你的代碼應該是這樣的:
$I->sendPUT('/upload_image', array(), array('file' => 'files.jpg'));