From 0f5a50b46b0433cc2f48321d8642da074552af38 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Sun, 3 Feb 2019 22:53:39 +0100 Subject: [PATCH] Bugfixing tests --- src/Database/DBA.php | 2 +- tests/DatabaseTest.php | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Database/DBA.php b/src/Database/DBA.php index dc3c62abea..eaeeb9cbdd 100644 --- a/src/Database/DBA.php +++ b/src/Database/DBA.php @@ -423,7 +423,7 @@ class DBA $orig_sql = $sql; - if (self::$config->get('system', 'db_callstack')) { + if (self::$config->get('system', 'db_callstack') !== null) { $sql = "/*".System::callstack()." */ ".$sql; } diff --git a/tests/DatabaseTest.php b/tests/DatabaseTest.php index 69ee750dbc..79af5b5468 100644 --- a/tests/DatabaseTest.php +++ b/tests/DatabaseTest.php @@ -5,7 +5,10 @@ namespace Friendica\Test; +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_Extensions_Database_DB_IDatabaseConnection; @@ -36,8 +39,12 @@ abstract class DatabaseTest extends MockedTest $this->markTestSkipped('Please set the MYSQL_* environment variables to your test database credentials.'); } + $basedir = BasePath::create(dirname(__DIR__)); + $configLoader = new Config\ConfigCacheLoader($basedir); + $config = Factory\ConfigFactory::createCache($configLoader); + DBA::connect( - __DIR__, + $config, getenv('MYSQL_HOST'), getenv('MYSQL_USERNAME'), getenv('MYSQL_PASSWORD'), -- 2.39.5