jeudi 26 novembre 2015

assertRedirectedToRoute not working in Laravel 5.1

Controller code:

return redirect()->route('admin.patient.edit', $patientId);

Test code:

$this->visit(route('admin.patient.edit', $this->patient->id))
     ->press('Update');

$this->assertRedirectedToRoute('admin.patient.edit', [$this->patient->id]);

The error I get is this:

Failed asserting that Illuminate\Http\Response Object (...) is an instance of class 
"Illuminate\Http\RedirectResponse".

I've printed out the response from the inside the test and inside the controller and it is in fact a RedirectReponse Object. Any ideas?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire