2 namespace Friendica\Test\src\Database;
5 use Friendica\BaseObject;
6 use Friendica\Core\Config;
7 use Friendica\Database\Database;
8 use Friendica\Database\DBA;
9 use Friendica\Test\DatabaseTest;
10 use Friendica\Test\Util\Database\StaticDatabase;
12 class DBATest extends DatabaseTest
14 public function setUp()
19 $dice = $dice->addRules(include __DIR__ . '/../../../static/dependencies.config.php');
20 $dice = $dice->addRule(Database::class, ['instanceOf' => StaticDatabase::class, 'shared' => true]);
21 BaseObject::setDependencyInjection($dice);
24 Config::set('config', 'hostname', 'localhost');
25 Config::set('system', 'throttle_limit_day', 100);
26 Config::set('system', 'throttle_limit_week', 100);
27 Config::set('system', 'throttle_limit_month', 100);
28 Config::set('system', 'theme', 'system_theme');
34 public function testExists() {
36 $this->assertTrue(DBA::exists('config', []));
37 $this->assertFalse(DBA::exists('notable', []));
39 $this->assertTrue(DBA::exists('config', null));
40 $this->assertFalse(DBA::exists('notable', null));
42 $this->assertTrue(DBA::exists('config', ['k' => 'hostname']));
43 $this->assertFalse(DBA::exists('config', ['k' => 'nonsense']));