markTestSkipped('pdo_mysql extension not loaded; retry path cannot be exercised.'); } // 127.0.0.1:1 is reserved (tcpmux) and effectively guaranteed closed // on dev hosts. The function loops $retries+1 times and applies a 2s // PDO::ATTR_TIMEOUT internally; with retries=1 the worst-case wall // time is ~4s for a refused-connection failure. $start = microtime(true); $result = db_connect_real( '127.0.0.1', 'invalid_user', 'invalid_pass', 'invalid_db', 'mysql', 1, 1 ); $elapsed = microtime(true) - $start; if ($elapsed > 10) { test()->markTestSkipped( sprintf('db_connect_real took %.1fs to fail; environment may be ' . 'rerouting 127.0.0.1:1.', $elapsed) ); } expect($result)->toBe(false); });