2018-07-21 14:43:43 +02:00
|
|
|
<?php
|
2019-02-27 12:32:56 +01:00
|
|
|
namespace Friendica\Test\src\Database;
|
2018-07-21 14:43:43 +02:00
|
|
|
|
2019-07-26 15:54:14 +02:00
|
|
|
use Dice\Dice;
|
|
|
|
use Friendica\BaseObject;
|
2018-07-21 14:43:43 +02:00
|
|
|
use Friendica\Core\Config;
|
|
|
|
use Friendica\Database\DBA;
|
|
|
|
use Friendica\Test\DatabaseTest;
|
|
|
|
|
|
|
|
class DBATest extends DatabaseTest
|
|
|
|
{
|
|
|
|
public function setUp()
|
|
|
|
{
|
2019-02-05 22:03:07 +01:00
|
|
|
parent::setUp();
|
2018-07-21 14:43:43 +02:00
|
|
|
|
2019-07-26 15:54:14 +02:00
|
|
|
$dice = new Dice();
|
|
|
|
$dice = $dice->addRules(include __DIR__ . '/../../../static/dependencies.config.php');
|
|
|
|
BaseObject::setDependencyInjection($dice);
|
|
|
|
|
2018-07-21 14:43:43 +02:00
|
|
|
// Default config
|
|
|
|
Config::set('config', 'hostname', 'localhost');
|
|
|
|
Config::set('system', 'throttle_limit_day', 100);
|
|
|
|
Config::set('system', 'throttle_limit_week', 100);
|
|
|
|
Config::set('system', 'throttle_limit_month', 100);
|
|
|
|
Config::set('system', 'theme', 'system_theme');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @small
|
|
|
|
*/
|
|
|
|
public function testExists() {
|
|
|
|
|
|
|
|
$this->assertTrue(DBA::exists('config', []));
|
|
|
|
$this->assertFalse(DBA::exists('notable', []));
|
|
|
|
|
|
|
|
$this->assertTrue(DBA::exists('config', null));
|
|
|
|
$this->assertFalse(DBA::exists('notable', null));
|
|
|
|
|
|
|
|
$this->assertTrue(DBA::exists('config', ['k' => 'hostname']));
|
|
|
|
$this->assertFalse(DBA::exists('config', ['k' => 'nonsense']));
|
|
|
|
}
|
|
|
|
}
|