msurguy / Honeypot

Simple spam prevention package for Laravel applications
maxoffsky.com/code-blog/implementing-honeypot-spam-prevention-in-laravel-applications/
MIT License
429 stars 44 forks source link

How can I mock this ? #39

Open LaurentEsc opened 9 years ago

LaurentEsc commented 9 years ago

Hi, thank you for this nice package which works nicely.

I am using it in a registration form and want to add an integration test to make sure the form can be filled and submitted properly. However, the form is filled too fast by my tests and the validation fails. I am looking for a way to mock the HoneypotValidator->validateHoneytime() method and make it return true during my test.

Is there a way to do this ?

Thank you

garygreen commented 9 years ago

You could just not add the honeypot and honeytime rules to your validator if it detects your app as running under a testing environment.