]> git.mxchange.org Git - friendica.git/blobdiff - tests/DatabaseTest.php
update FR translations THX hypolite
[friendica.git] / tests / DatabaseTest.php
index ec1eb290d10b8b4584f3c63c42ca24963c5aa8b5..79af5b5468a9495f86d390ceda58d1afdc4d64eb 100644 (file)
@@ -5,13 +5,12 @@
 
 namespace Friendica\Test;
 
-use Friendica\App;
-use Friendica\BaseObject;
 use Friendica\Core\Config;
 use Friendica\Database\DBA;
+use Friendica\Factory;
+use Friendica\Util\BasePath;
 use PHPUnit\DbUnit\DataSet\YamlDataSet;
 use PHPUnit\DbUnit\TestCaseTrait;
-use PHPUnit\Framework\TestCase;
 use PHPUnit_Extensions_Database_DB_IDatabaseConnection;
 
 require_once __DIR__ . '/../boot.php';
@@ -19,7 +18,7 @@ require_once __DIR__ . '/../boot.php';
 /**
  * Abstract class used by tests that need a database.
  */
-abstract class DatabaseTest extends TestCase
+abstract class DatabaseTest extends MockedTest
 {
        use TestCaseTrait;
 
@@ -40,7 +39,13 @@ abstract class DatabaseTest extends TestCase
                        $this->markTestSkipped('Please set the MYSQL_* environment variables to your test database credentials.');
                }
 
-               DBA::connect(getenv('MYSQL_HOST'),
+               $basedir = BasePath::create(dirname(__DIR__));
+               $configLoader = new Config\ConfigCacheLoader($basedir);
+               $config = Factory\ConfigFactory::createCache($configLoader);
+
+               DBA::connect(
+                       $config,
+                       getenv('MYSQL_HOST'),
                        getenv('MYSQL_USERNAME'),
                        getenv('MYSQL_PASSWORD'),
                        getenv('MYSQL_DATABASE'));