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
4f729a21
Commit
4f729a21
authored
Jan 31, 2017
by
Nguyen Van Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simple unit test
parent
8f7b8b33
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
tests/NoCaptchaTest.php
tests/NoCaptchaTest.php
+32
-0
No files found.
tests/NoCaptchaTest.php
0 → 100644
View file @
4f729a21
<?php
use
Anhskohbo\NoCaptcha\NoCaptcha
;
class
NoCaptchaTest
extends
PHPUnit_Framework_TestCase
{
private
$captcha
;
public
function
setUp
()
{
parent
::
setUp
();
$this
->
captcha
=
new
NoCaptcha
(
'{secret-key}'
,
'{site-key}'
);
}
public
function
testDisplay
()
{
$this
->
assertTrue
(
$this
->
captcha
instanceof
NoCaptcha
);
$simple
=
'<script src="https://www.google.com/recaptcha/api.js" async defer></script>'
.
"
\n
"
.
'<div class="g-recaptcha" data-sitekey="{site-key}"></div>'
;
$withLang
=
'<script src="https://www.google.com/recaptcha/api.js?hl=vi" async defer></script>'
.
"
\n
"
.
'<div class="g-recaptcha" data-sitekey="{site-key}"></div>'
;
$withAttrs
=
'<script src="https://www.google.com/recaptcha/api.js" async defer></script>'
.
"
\n
"
.
'<div class="g-recaptcha" data-theme="light" data-sitekey="{site-key}"></div>'
;
$this
->
assertEquals
(
$this
->
captcha
->
display
(),
$simple
);
$this
->
assertEquals
(
$this
->
captcha
->
display
([],
'vi'
),
$withLang
);
$this
->
assertEquals
(
$this
->
captcha
->
display
([
'data-theme'
=>
'light'
]),
$withAttrs
);
}
}
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