- if (!dba::$connected) {
- dba::connect('localhost', getenv('USER'), getenv('PASS'), getenv('DB'));
-
- if (dba::$connected) {
- $app = get_app();
- // We need to do this in order to disable logging
- $app->module = 'install';
-
- // Create database structure
- DBStructure::update(false, true, true);
- } else {
- $this->markTestSkipped('Could not connect to the database.');
- }
+ if (!getenv('MYSQL_DATABASE')) {
+ $this->markTestSkipped('Please set the MYSQL_* environment variables to your test database credentials.');
+ }
+
+ DBA::connect(getenv('MYSQL_HOST'),
+ getenv('MYSQL_USERNAME'),
+ getenv('MYSQL_PASSWORD'),
+ getenv('MYSQL_DATABASE'));
+
+ if (!DBA::connected()) {
+ $this->markTestSkipped('Could not connect to the database.');