mercredi 25 décembre 2019

Laravel 5.8 Illuminate\Validation\ValidationException: The given data was invalid

I have store method in my controller like this

public function store()
{
     request()->validate(['family'=>'required']);
     User::create(request()->all());
     return redirect('/users');
}

and test method like this

/** @test */
public function a_user_require_family()
{
    $this->withoutExceptionHandling();
    $this->post('/users', [])->assertSessionHasErrors('family');
}

It show me this:

1) Tests\Feature\UserTest::a_user_require_family
Illuminate\Validation\ValidationException: The given data was invalid.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Sqidtx
via IFTTT

Aucun commentaire:

Enregistrer un commentaire