Bugfixing tests

This commit is contained in:
Philipp Holzer 2019-02-03 22:53:39 +01:00
parent 1e0e1674f2
commit 0f5a50b46b
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
2 changed files with 9 additions and 2 deletions

View file

@ -423,7 +423,7 @@ class DBA
$orig_sql = $sql; $orig_sql = $sql;
if (self::$config->get('system', 'db_callstack')) { if (self::$config->get('system', 'db_callstack') !== null) {
$sql = "/*".System::callstack()." */ ".$sql; $sql = "/*".System::callstack()." */ ".$sql;
} }

View file

@ -5,7 +5,10 @@
namespace Friendica\Test; namespace Friendica\Test;
use Friendica\Core\Config;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Factory;
use Friendica\Util\BasePath;
use PHPUnit\DbUnit\DataSet\YamlDataSet; use PHPUnit\DbUnit\DataSet\YamlDataSet;
use PHPUnit\DbUnit\TestCaseTrait; use PHPUnit\DbUnit\TestCaseTrait;
use PHPUnit_Extensions_Database_DB_IDatabaseConnection; 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.'); $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( DBA::connect(
__DIR__, $config,
getenv('MYSQL_HOST'), getenv('MYSQL_HOST'),
getenv('MYSQL_USERNAME'), getenv('MYSQL_USERNAME'),
getenv('MYSQL_PASSWORD'), getenv('MYSQL_PASSWORD'),