2 namespace Friendica\Test\src\Database;
5 use Friendica\Core\Config;
6 use Friendica\Core\Config\Cache\PConfigCache;
7 use Friendica\Core\L10n\L10n;
8 use Friendica\Database\DBA;
10 use Friendica\Test\DatabaseTest;
11 use Friendica\Util\BaseURL;
13 class DBATest extends DatabaseTest
15 public function setUp()
17 $configModel = new \Friendica\Model\Config\Config(self::$dba);
18 $config = Factory\ConfigFactory::createConfig(self::$configCache, $configModel);
19 $pconfigModel = new \Friendica\Model\Config\PConfig(self::$dba);
20 Factory\ConfigFactory::createPConfig(self::$configCache, new PConfigCache(), $pconfigModel);
21 $logger = Factory\LoggerFactory::create('test', self::$dba, $config, self::$profiler);
22 $baseUrl = new BaseURL($config, $_SERVER);
23 $router = new App\Router();
24 $l10n = new L10n($config,
27 $this->app = new App(self::$dba, $config, self::$mode, $router, $baseUrl, $logger, self::$profiler, $l10n, false);
32 Config::set('config', 'hostname', 'localhost');
33 Config::set('system', 'throttle_limit_day', 100);
34 Config::set('system', 'throttle_limit_week', 100);
35 Config::set('system', 'throttle_limit_month', 100);
36 Config::set('system', 'theme', 'system_theme');
42 public function testExists() {
44 $this->assertTrue(DBA::exists('config', []));
45 $this->assertFalse(DBA::exists('notable', []));
47 $this->assertTrue(DBA::exists('config', null));
48 $this->assertFalse(DBA::exists('notable', null));
50 $this->assertTrue(DBA::exists('config', ['k' => 'hostname']));
51 $this->assertFalse(DBA::exists('config', ['k' => 'nonsense']));