X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=tests%2FDatabaseTest.php;h=ec1eb290d10b8b4584f3c63c42ca24963c5aa8b5;hb=3e6ea9383b1190bccb440e6a2b710f263fdd468b;hp=52ca3f68d37f098df050af42e878e6be6f563881;hpb=a2fb49a2b4cdaca9b938e0a750575ae502c5ec63;p=friendica.git diff --git a/tests/DatabaseTest.php b/tests/DatabaseTest.php index 52ca3f68d3..ec1eb290d1 100644 --- a/tests/DatabaseTest.php +++ b/tests/DatabaseTest.php @@ -5,6 +5,7 @@ namespace Friendica\Test; +use Friendica\App; use Friendica\BaseObject; use Friendica\Core\Config; use Friendica\Database\DBA; @@ -13,20 +14,14 @@ 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 { - public function setUp() - { - // Reusable App object - $this->app = BaseObject::getApp(); - - Config::set('system', 'url', 'http://localhost'); - Config::set('system', 'hostname', 'localhost'); - Config::set('system', 'worker_dont_fork', true); - } + use TestCaseTrait; /** * Get database connection. @@ -45,6 +40,11 @@ abstract class DatabaseTest extends TestCase $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.'); }