Fix intermittent error in pdo_mysql___construct_options.phpt

For the love of god, don't write tests based on mt_rand!
This commit is contained in:
Nikita Popov 2019-12-06 07:38:56 +01:00
parent e760d94f4b
commit 8753975418
2 changed files with 1 additions and 10 deletions

View File

@ -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");

View File

@ -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);