vendredi 16 juin 2017

How can I mock unique validation rule?

I am writing test cases for a store() function of a ResourceController which adds a new resource in database.

I am not allowed to access database in my test cases, So I am mocking all the database interactions & now I need to mock the unique validation rule.

I have Googled it & even searched on the stackoverflow but I didn't found anything specific.

Here is what I know:- I can mock the \Validator::getPresenceVerifier() & \Validator::setPresenceVerifier() but if I mock them, then i will not be able to make the validator object. StackOverflow Question Here

Can anyone guide me in the right direction.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire