diff options
author | Marc Alexander <admin@m-a-styles.de> | 2019-10-20 15:51:47 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2019-10-20 15:51:47 +0200 |
commit | 8b6776eed22edc33b3f35946fba6b5de4bfe73a1 (patch) | |
tree | 3c92b92c7a263d00f36367c8f03d0e9171330099 /tests | |
parent | 1ba0ae6e8530d3dab55ad1333c0d392eefa2d401 (diff) | |
download | forums-8b6776eed22edc33b3f35946fba6b5de4bfe73a1.tar forums-8b6776eed22edc33b3f35946fba6b5de4bfe73a1.tar.gz forums-8b6776eed22edc33b3f35946fba6b5de4bfe73a1.tar.bz2 forums-8b6776eed22edc33b3f35946fba6b5de4bfe73a1.tar.xz forums-8b6776eed22edc33b3f35946fba6b5de4bfe73a1.zip |
[ticket/16078] Use while loop for visit retries
PHPBB3-16078
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_framework/phpbb_ui_test_case.php | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php index e7c9bd4d0b..48e510abe3 100644 --- a/tests/test_framework/phpbb_ui_test_case.php +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -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; + } } } } |