]> git.mxchange.org Git - friendica.git/blob - tests/src/Database/DBATest.php
Fix tests
[friendica.git] / tests / src / Database / DBATest.php
1 <?php
2 namespace Friendica\Test\src\Database;
3
4 use Dice\Dice;
5 use Friendica\BaseObject;
6 use Friendica\Core\Config;
7 use Friendica\Database\DBA;
8 use Friendica\Test\DatabaseTest;
9
10 class DBATest extends DatabaseTest
11 {
12         public function setUp()
13         {
14                 parent::setUp();
15
16                 $dice = new Dice();
17                 $dice = $dice->addRules(include __DIR__ . '/../../../static/dependencies.config.php');
18                 BaseObject::setDependencyInjection($dice);
19
20                 // Default config
21                 Config::set('config', 'hostname', 'localhost');
22                 Config::set('system', 'throttle_limit_day', 100);
23                 Config::set('system', 'throttle_limit_week', 100);
24                 Config::set('system', 'throttle_limit_month', 100);
25                 Config::set('system', 'theme', 'system_theme');
26         }
27
28         /**
29          * @small
30          */
31         public function testExists() {
32
33                 $this->assertTrue(DBA::exists('config', []));
34                 $this->assertFalse(DBA::exists('notable', []));
35
36                 $this->assertTrue(DBA::exists('config', null));
37                 $this->assertFalse(DBA::exists('notable', null));
38
39                 $this->assertTrue(DBA::exists('config', ['k' => 'hostname']));
40                 $this->assertFalse(DBA::exists('config', ['k' => 'nonsense']));
41         }
42 }