namespace Friendica\Test;
+use Friendica\App;
+use Friendica\BaseObject;
+use Friendica\Core\Config;
use Friendica\Database\DBA;
use PHPUnit\DbUnit\DataSet\YamlDataSet;
use PHPUnit\DbUnit\TestCaseTrait;
use PHPUnit\Framework\TestCase;
use PHPUnit_Extensions_Database_DB_IDatabaseConnection;
+require_once __DIR__ . '/../boot.php';
+
/**
* Abstract class used by tests that need a database.
*/
abstract class DatabaseTest extends TestCase
{
-
use TestCaseTrait;
/**
*/
protected function getConnection()
{
+ 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.');
}