Add JSON endpoint for CAPTCHA rendering
To be used inside WP/WC registration form to construct URL for CAPTCHA page. [MAILPOET-6325]
This commit is contained in:
committed by
David Remer
parent
d2ebfba8c3
commit
df171fdcc7
29
mailpoet/tests/integration/API/JSON/v1/CaptchaTest.php
Normal file
29
mailpoet/tests/integration/API/JSON/v1/CaptchaTest.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace integration\API\JSON\v1;
|
||||
|
||||
use MailPoet\API\JSON\Response;
|
||||
use MailPoet\API\JSON\v1\Captcha;
|
||||
use MailPoet\Captcha\CaptchaSession;
|
||||
use MailPoet\Captcha\CaptchaUrlFactory;
|
||||
use MailPoet\Config\Populator;
|
||||
|
||||
class CaptchaTest extends \MailPoetTest {
|
||||
public function _before() {
|
||||
$populator = $this->diContainer->get(Populator::class);
|
||||
$populator->up();
|
||||
|
||||
parent::_before();
|
||||
}
|
||||
|
||||
public function testItCanRenderCaptcha(): void {
|
||||
$captchaSession = $this->diContainer->get(CaptchaSession::class);
|
||||
$urlFactory = $this->diContainer->get(CaptchaUrlFactory::class);
|
||||
|
||||
$captcha = new Captcha($captchaSession, $urlFactory);
|
||||
$response = $captcha->render();
|
||||
|
||||
verify($response->status)->equals(Response::REDIRECT);
|
||||
verify($response->location)->stringContainsString('mailpoet_router&endpoint=captcha&action=render&data=');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user