Tests: Fix database locking bug

pull/7203/head
Aleksander Machniak 5 years ago
parent 84aa5d93f1
commit 8080eb2c71

@ -146,6 +146,8 @@ class GeneralTest extends \Tests\Browser\TestCase
$browser->assertCheckboxState('_pretty_date', $this->settings['pretty_date']);
$browser->assertCheckboxState('_display_next', $this->settings['display_next']);
$browser->assertCheckboxState('_standard_windows', $this->settings['standard_windows']);
});
});
// Assert the options have been saved in database properly
$prefs = \bootstrap::get_prefs();
@ -157,7 +159,5 @@ class GeneralTest extends \Tests\Browser\TestCase
$this->assertEquals($this->settings['pretty_date'], $prefs['prettydate']);
$this->assertEquals($this->settings['refresh_interval'], $prefs['refresh_interval']/60);
});
});
}
}

@ -243,7 +243,13 @@ class bootstrap
*/
public static function get_prefs()
{
$db = rcmail::get_instance()->get_dbh();
$rcmail = rcmail::get_instance();
// Create a separate connection to the DB, otherwise
// we hit some strange and hard to investigate locking issues
$db = rcube_db::factory($rcmail->config->get('db_dsnw'), $rcmail->config->get('db_dsnr'), false);
$db->set_debug((bool)$rcmail->config->get('sql_debug'));
$query = $db->query("SELECT preferences FROM users WHERE username = ?", TESTS_USER);
$record = $db->fetch_assoc($query);

Loading…
Cancel
Save