diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-12-06 07:38:56 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-12-06 07:39:54 +0100 |
commit | 8753975418e8737b433b2b8ad818d829f5edca96 (patch) | |
tree | 1386df3a61d2bafbe73766b1b55cc8c44b3ff156 | |
parent | e760d94f4bb4d0802e89af0927cecfb479cba024 (diff) | |
download | php-git-8753975418e8737b433b2b8ad818d829f5edca96.tar.gz |
Fix intermittent error in pdo_mysql___construct_options.phpt
For the love of god, don't write tests based on mt_rand!
-rw-r--r-- | ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt | 4 | ||||
-rw-r--r-- | ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt | 7 |
2 files changed, 1 insertions, 10 deletions
diff --git a/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt b/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt index 9482a13bfa..b7a52127c5 100644 --- a/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt @@ -76,9 +76,7 @@ MySQLPDOTest::skip(); if (!is_object($db = new PDO($dsn, $user, $pass, array()))) printf("[002] Expecting object got %s/%s¸\n", gettype($db), $db); - do { - $invalid = mt_rand(-1000, 1000); - } while (isset($valid_options[$invalid])); + $invalid = 999; if (is_object($db = new PDO($dsn, $user, $pass, array($invalid => true)))) printf("[003] [TODO][CHANGEREQUEST] Please, lets not ignore invalid options and bail out!\n"); diff --git a/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt b/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt index 2eb34cd076..51310faa9e 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt @@ -15,13 +15,6 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db)) $db = MySQLPDOTest::factory(); MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); - function find_invalid_int($valid_options) { - do { - $invalid = mt_rand(-10000, 10000); - } while (in_array($invalid, $valid_options)); - return $invalid; - } - function set_and_get($offset, $db, $attribute, $value) { $value_type = gettype($value); |