Use the reCAPTCHA Enterprise API.
This commit is contained in:
@@ -35,24 +35,24 @@ class ValidateDataTest extends TestCase {
|
||||
}
|
||||
|
||||
public function testVisitorsNeedTheCaptcha(): void {
|
||||
FakeRecaptcha::install('{"success": false}');
|
||||
FakeRecaptcha::install('{"tokenProperties":{"valid":false}}');
|
||||
$this->assertSame(array('captcha' => 'Please complete the captcha.'), $this->validate(array('g-recaptcha-response' => 'r'), FALSE));
|
||||
}
|
||||
|
||||
public function testASolvedCaptchaIsRemembered(): void {
|
||||
FakeRecaptcha::install('{"success": true}');
|
||||
FakeRecaptcha::install();
|
||||
$this->assertSame(array(), $this->validate(array('g-recaptcha-response' => 'r'), FALSE));
|
||||
$this->assertGreaterThan(time() - 5, $_SESSION['captcha_ok']);
|
||||
}
|
||||
|
||||
public function testAnOldCaptchaPassDoesNotCount(): void {
|
||||
FakeRecaptcha::install('{"success": false}');
|
||||
FakeRecaptcha::install('{"tokenProperties":{"valid":false}}');
|
||||
$_SESSION['captcha_ok'] = time() - CAPTCHA_PASS_SECONDS - 1;
|
||||
$this->assertArrayHasKey('captcha', $this->validate(array(), FALSE));
|
||||
}
|
||||
|
||||
public function testEditorsNeedNoCaptcha(): void {
|
||||
FakeRecaptcha::install('{"success": false}');
|
||||
FakeRecaptcha::install('{"tokenProperties":{"valid":false}}');
|
||||
$this->asEditor();
|
||||
$this->assertSame(array(), $this->validate(array(), FALSE));
|
||||
$this->assertSame(array(), FakeRecaptcha::$requests);
|
||||
|
||||
Reference in New Issue
Block a user