mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[ticket/16078] Use while loop for visit retries
PHPBB3-16078
This commit is contained in:
parent
1ba0ae6e85
commit
8b6776eed2
1 changed files with 10 additions and 7 deletions
|
@ -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
|
||||
$attempts = 0;
|
||||
$retries = 3;
|
||||
|
||||
while (true)
|
||||
{
|
||||
$attempts++;
|
||||
try
|
||||
{
|
||||
$this->getDriver()->get(self::$root_url . $path);
|
||||
break;
|
||||
}
|
||||
catch (Facebook\WebDriver\Exception\WebDriverCurlException $exception)
|
||||
{
|
||||
try
|
||||
if ($attempts >= $retries)
|
||||
{
|
||||
$this->getDriver()->get(self::$root_url . $path);
|
||||
throw $exception;
|
||||
}
|
||||
catch (Facebook\WebDriver\Exception\WebDriverCurlException $exception)
|
||||
{
|
||||
// Last try, throw exception after this one fails
|
||||
$this->getDriver()->get(self::$root_url . $path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue