]> git.mxchange.org Git - friendica.git/blob - tests/src/Database/DBATest.php
Remove Phpunit/Dbunit
[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\Database;
8 use Friendica\Database\DBA;
9 use Friendica\Test\DatabaseTest;
10 use Friendica\Test\Util\Database\StaticDatabase;
11
12 class DBATest extends DatabaseTest
13 {
14         public function setUp()
15         {
16                 parent::setUp();
17
18                 $dice = new Dice();
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);
22
23                 // Default config
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');
29         }
30
31         /**
32          * @small
33          */
34         public function testExists() {
35
36                 $this->assertTrue(DBA::exists('config', []));
37                 $this->assertFalse(DBA::exists('notable', []));
38
39                 $this->assertTrue(DBA::exists('config', null));
40                 $this->assertFalse(DBA::exists('notable', null));
41
42                 $this->assertTrue(DBA::exists('config', ['k' => 'hostname']));
43                 $this->assertFalse(DBA::exists('config', ['k' => 'nonsense']));
44         }
45 }