2 namespace Friendica\Test\src\Database;
5 use Friendica\Database\Database;
6 use Friendica\Database\DBA;
8 use Friendica\Test\DatabaseTest;
9 use Friendica\Test\Util\Database\StaticDatabase;
11 class DBATest extends DatabaseTest
13 public function setUp()
18 ->addRules(include __DIR__ . '/../../../static/dependencies.config.php')
19 ->addRule(Database::class, ['instanceOf' => StaticDatabase::class, 'shared' => true]);
23 DI::config()->set('config', 'hostname', 'localhost');
24 DI::config()->set('system', 'throttle_limit_day', 100);
25 DI::config()->set('system', 'throttle_limit_week', 100);
26 DI::config()->set('system', 'throttle_limit_month', 100);
27 DI::config()->set('system', 'theme', 'system_theme');
33 public function testExists() {
35 $this->assertTrue(DBA::exists('config', []));
36 $this->assertFalse(DBA::exists('notable', []));
38 $this->assertTrue(DBA::exists('config', null));
39 $this->assertFalse(DBA::exists('notable', null));
41 $this->assertTrue(DBA::exists('config', ['k' => 'hostname']));
42 $this->assertFalse(DBA::exists('config', ['k' => 'nonsense']));