We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello, Is there any way to mock the CAPTCHA in an unit for feature test? Thanks!
The text was updated successfully, but these errors were encountered:
My solution, forcing the captcha validation rule to just return true:
captcha
return true
public function testSomething() { $this->mockValidatorExtension(config('bone.captcha.validator'), function () { return true; }); //....... } /** * @param string $rule * @param \Closure|string $extensionStub */ private function mockValidatorExtension($rule, $extensionStub) { $validator = $this->app->get('validator'); $reflection = new ReflectionClass($validator); $property = $reflection->getProperty('extensions'); $property->setAccessible(true); $extensions = $property->getValue($validator); $extensions[$rule] = $extensionStub; $property->setValue($validator, $extensions); }
credits: https://github.com/framgia/laravel-test-guideline/blob/master/en/Unit/Validation.md
Sorry, something went wrong.
No branches or pull requests
Hello,
Is there any way to mock the CAPTCHA in an unit for feature test?
Thanks!
The text was updated successfully, but these errors were encountered: