public function checkDatabaseConnection(InstallationData $data, ExecutionContextInterface $context)
{
try {
// create instance
$db = new \SpoonDatabase('mysql', $data->getDbHostname(), $data->getDbUsername(), $data->getDbPassword(), $data->getDbDatabase(), $data->getDbPort());
// test table
$table = 'test' . time();
// attempt to create table
$db->execute('DROP TABLE IF EXISTS ' . $table);
$db->execute('CREATE TABLE ' . $table . ' (id int(11) NOT NULL) ENGINE=MyISAM');
// drop table
$db->drop($table);
} catch (\Exception $e) {
$context->addViolation('Problem with database credentials');
}
}