I'm trying to test an ajax file upload in phpunit with Laravel 5.1
/** @test */
public function it_uploads_a_user_dp(){
$this->be(\App\User::where('username', 'ringo')->first());
$this->withoutMiddleware();
$this->attach('C:\Users\User\Downloads\858696_10200257365370424_481867196_o.jpg', 'custom_dp')
->post('/account/upload_dp')
->seeJson(["success"=>true]);
}
I tried this, but it's not passing the condition if (Input::hasFile('custom_dp')) in my controller and return "success"->false
How can I test this file upload via Ajax in Phpunit?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire