X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=tests%2FDatabaseTest.php;h=b3418c20f4024878c9999ebf9f6d908d6374335b;hb=4b4a319af99de52a3ee751b5d7f0ea2e05966550;hp=ec1eb290d10b8b4584f3c63c42ca24963c5aa8b5;hpb=7ee8bdafc53a88fe51f233e14169bb4af0d376ab;p=friendica.git diff --git a/tests/DatabaseTest.php b/tests/DatabaseTest.php index ec1eb290d1..b3418c20f4 100644 --- a/tests/DatabaseTest.php +++ b/tests/DatabaseTest.php @@ -6,12 +6,14 @@ 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 Friendica\Util\Config\ConfigFileLoader; +use Friendica\Util\Logger\VoidLogger; +use Friendica\Util\Profiler; 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 +21,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 +42,18 @@ abstract class DatabaseTest extends TestCase $this->markTestSkipped('Please set the MYSQL_* environment variables to your test database credentials.'); } - DBA::connect(getenv('MYSQL_HOST'), + $basePath = BasePath::create(dirname(__DIR__)); + $mode = new App\Mode($basePath); + $configLoader = new ConfigFileLoader($basePath, $mode); + $config = Factory\ConfigFactory::createCache($configLoader); + + $profiler = \Mockery::mock(Profiler::class); + + DBA::connect( + $config, + $profiler, + new VoidLogger(), + getenv('MYSQL_HOST'), getenv('MYSQL_USERNAME'), getenv('MYSQL_PASSWORD'), getenv('MYSQL_DATABASE'));