2014-12-23 52 views
0

我試圖在我的測試中模擬ajax樣式上傳文件。是否可以使用sendPUT發送文件並返回響應?控制器通過Input::file()接收值 - 我似乎無法訪問sendPUT通過Input::file發送的值。Codeception sendPUT類型爲輸入::文件

$I->sendPUT('/upload_image', array('file' => 'files.jpg')); 

回答

0

您沒有正確使用此功能。

一切都在official documentation解釋:

sendPUT

發送PUT請求到給定的URI。

  • param $網址
  • param array $ PARAMS
  • param array $文件

第三個參數是你在找什麼。你的代碼應該是這樣的:

$I->sendPUT('/upload_image', array(), array('file' => 'files.jpg'));