mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 05:50:42 +02:00
[ticket/16078] Use while loop for visit retries
PHPBB3-16078
This commit is contained in:
@@ -159,20 +159,23 @@ class phpbb_ui_test_case extends phpbb_test_case
|
|||||||
public function visit($path)
|
public function visit($path)
|
||||||
{
|
{
|
||||||
// Retry three times on curl issues, e.g. timeout
|
// Retry three times on curl issues, e.g. timeout
|
||||||
try
|
$attempts = 0;
|
||||||
{
|
$retries = 3;
|
||||||
$this->getDriver()->get(self::$root_url . $path);
|
|
||||||
}
|
while (true)
|
||||||
catch (Facebook\WebDriver\Exception\WebDriverCurlException $exception)
|
|
||||||
{
|
{
|
||||||
|
$attempts++;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->getDriver()->get(self::$root_url . $path);
|
$this->getDriver()->get(self::$root_url . $path);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
catch (Facebook\WebDriver\Exception\WebDriverCurlException $exception)
|
catch (Facebook\WebDriver\Exception\WebDriverCurlException $exception)
|
||||||
{
|
{
|
||||||
// Last try, throw exception after this one fails
|
if ($attempts >= $retries)
|
||||||
$this->getDriver()->get(self::$root_url . $path);
|
{
|
||||||
|
throw $exception;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user