Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
no-captcha
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
CENTER-TBI
no-captcha
Commits
3258005b
Commit
3258005b
authored
Dec 14, 2015
by
Mike Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+ added documentation for working with Laravel testing.
parent
753d49a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
README.md
README.md
+25
-0
No files found.
README.md
View file @
3258005b
...
...
@@ -58,6 +58,31 @@ $validate = Validator::make(Input::all(), [
```
### Testing
When using the (Laravel Testing functionality)
[
http://laravel.com/docs/5.1/testing
]
, you will need to mock out the response for the captcha form element. To do this:
1) Setup NoCaptcha facade in config/app.conf
```
php
'NoCaptcha'
=>
'Anhskohbo\NoCaptcha\Facades\NoCaptcha'
```
2) For any form tests involving the captcha, you can then mock the facade behaviour:
```
php
// prevent validation error on captcha
NoCaptcha
::
shouldReceive
(
'verifyResponse'
)
->
once
()
->
andReturn
(
true
);
// provide hidden input for your 'required' validation
NoCaptcha
::
shouldReceive
(
'display'
)
->
zeroOrMoreTimes
()
->
andReturn
(
'<input type="hidden" name="g-recaptcha-response" value="1" />'
);
```
You can then test the remainder of your form as normal.
## Without Laravel
Checkout example below:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment