1
0
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:
Marc Alexander
2024-10-15 21:05:01 +02:00
parent 9eb18f351b
commit 61e265e4b4
2 changed files with 273 additions and 1 deletions

View File

@@ -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}
*/