mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[ticket/17413] Start implementation of unit tests
PHPBB-17413
This commit is contained in:
@@ -31,6 +31,9 @@ class turnstile extends base
|
||||
/** @var string API endpoint for turnstile verification */
|
||||
private const VERIFY_ENDPOINT = 'https://challenges.cloudflare.com/turnstile/v0/siteverify';
|
||||
|
||||
/** @var Client */
|
||||
protected Client $client;
|
||||
|
||||
/** @var language */
|
||||
protected language $language;
|
||||
|
||||
@@ -141,7 +144,7 @@ class turnstile extends base
|
||||
];
|
||||
|
||||
// Create guzzle client
|
||||
$client = new Client();
|
||||
$client = $this->get_client();
|
||||
|
||||
// Check captcha with turnstile API
|
||||
try
|
||||
@@ -174,6 +177,21 @@ class turnstile extends base
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Guzzle client
|
||||
*
|
||||
* @return Client
|
||||
*/
|
||||
protected function get_client(): Client
|
||||
{
|
||||
if (!isset($this->client))
|
||||
{
|
||||
$this->client = new Client();
|
||||
}
|
||||
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
Reference in New Issue
Block a user