1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-13 20:32:11 +02:00

[ticket/16078] Use while loop for visit retries

PHPBB3-16078
This commit is contained in:
Marc Alexander 2019-10-20 15:51:47 +02:00
parent 1ba0ae6e85
commit 8b6776eed2
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995

View File

@ -159,20 +159,23 @@ class phpbb_ui_test_case extends phpbb_test_case
public function visit($path)
{
// Retry three times on curl issues, e.g. timeout
try
{
$this->getDriver()->get(self::$root_url . $path);
}
catch (Facebook\WebDriver\Exception\WebDriverCurlException $exception)
$attempts = 0;
$retries = 3;
while (true)
{
$attempts++;
try
{
$this->getDriver()->get(self::$root_url . $path);
break;
}
catch (Facebook\WebDriver\Exception\WebDriverCurlException $exception)
{
// Last try, throw exception after this one fails
$this->getDriver()->get(self::$root_url . $path);
if ($attempts >= $retries)
{
throw $exception;
}
}
}
}