diff options
author | tailor <cygnus@janrain.com> | 2006-02-08 20:33:36 +0000 |
---|---|---|
committer | tailor <cygnus@janrain.com> | 2006-02-08 20:33:36 +0000 |
commit | 6fc2f50bb51bf793c35e00c914e686a9fdbd52b4 (patch) | |
tree | 2dda719062dc109e2e11ed7b111ad651a08d07af /Tests/Auth/OpenID/StoreTest.php | |
parent | 6a619a4cc8db4153635720ee2c1acdb303dae5ee (diff) | |
download | php-openid-6fc2f50bb51bf793c35e00c914e686a9fdbd52b4.zip php-openid-6fc2f50bb51bf793c35e00c914e686a9fdbd52b4.tar.gz php-openid-6fc2f50bb51bf793c35e00c914e686a9fdbd52b4.tar.bz2 |
[project @ Fixed database connection code for postgres store test.]
Diffstat (limited to 'Tests/Auth/OpenID/StoreTest.php')
-rw-r--r-- | Tests/Auth/OpenID/StoreTest.php | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Tests/Auth/OpenID/StoreTest.php b/Tests/Auth/OpenID/StoreTest.php index 75f2254..48cf33e 100644 --- a/Tests/Auth/OpenID/StoreTest.php +++ b/Tests/Auth/OpenID/StoreTest.php @@ -359,11 +359,24 @@ explicitly'); return; } - // Try to create the test database. - $result = $template_db->query(sprintf("CREATE DATABASE %s", - $temp_db_name)); + $allowed_failures = 5; + $failures = 0; + $success = false; + + while (($failures < $allowed_failures) && !$success) { + // Try to create the test database. + $result = $template_db->query(sprintf("CREATE DATABASE %s", + $temp_db_name)); + + if (PEAR::isError($result)) { + $failures++; + sleep(1); + } else { + $success = true; + } + } - if (PEAR::isError($result)) { + if (!$success) { $this->fail("Temporary database creation failed ". "('$temp_db_name'): " . $result->getMessage()); return; |