1
1
Fork 0

Merge pull request #5552 from MrPetovan/bug/5405-prevent-database-erasure-during-test

Skip DB tests if MYSQL_* environment variables are missing
This commit is contained in:
Michael Vogel 2018-08-04 21:43:12 +02:00 committed by GitHub
commit df0c3c0562
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -32,6 +32,10 @@ abstract class DatabaseTest extends TestCase
*/ */
protected function getConnection() protected function getConnection()
{ {
if (!getenv('MYSQL_DATABASE')) {
$this->markTestSkipped('Please set the MYSQL_* environment variables to your test database credentials.');
}
if (!DBA::connected()) { if (!DBA::connected()) {
$this->markTestSkipped('Could not connect to the database.'); $this->markTestSkipped('Could not connect to the database.');
} }