mirror of
https://github.com/friendica/friendica
synced 2025-04-24 15:50:12 +00:00
Changing Friendica\App\Mode from static methods to public methods
- Changing from static methods to public methods - Adding dev-composer-dependency Mockery for static method mocking (f.e. Config, DBA) - Adding ModeTest with Mocking - removing bootstrap from phpunit.xml because of double loading tests\bootstrap.php
This commit is contained in:
parent
5014779052
commit
31148e25cf
21 changed files with 498 additions and 106 deletions
|
@ -29,12 +29,14 @@ class PConfig extends BaseObject
|
|||
|
||||
public static function init($uid)
|
||||
{
|
||||
$a = self::getApp();
|
||||
|
||||
// Database isn't ready or populated yet
|
||||
if (!App\Mode::has(App\Mode::DBCONFIGAVAILABLE)) {
|
||||
if (!$a->getMode()->has(App\Mode::DBCONFIGAVAILABLE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self::getApp()->getConfigValue('system', 'config_adapter') == 'preload') {
|
||||
if ($a->getConfigValue('system', 'config_adapter') == 'preload') {
|
||||
self::$adapter = new Config\PreloadPConfigAdapter($uid);
|
||||
} else {
|
||||
self::$adapter = new Config\JITPConfigAdapter($uid);
|
||||
|
@ -55,7 +57,7 @@ class PConfig extends BaseObject
|
|||
public static function load($uid, $family)
|
||||
{
|
||||
// Database isn't ready or populated yet
|
||||
if (!App\Mode::has(App\Mode::DBCONFIGAVAILABLE)) {
|
||||
if (!self::getApp()->getMode()->has(App\Mode::DBCONFIGAVAILABLE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -84,7 +86,7 @@ class PConfig extends BaseObject
|
|||
public static function get($uid, $family, $key, $default_value = null, $refresh = false)
|
||||
{
|
||||
// Database isn't ready or populated yet
|
||||
if (!App\Mode::has(App\Mode::DBCONFIGAVAILABLE)) {
|
||||
if (!self::getApp()->getMode()->has(App\Mode::DBCONFIGAVAILABLE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -113,7 +115,7 @@ class PConfig extends BaseObject
|
|||
public static function set($uid, $family, $key, $value)
|
||||
{
|
||||
// Database isn't ready or populated yet
|
||||
if (!App\Mode::has(App\Mode::DBCONFIGAVAILABLE)) {
|
||||
if (!self::getApp()->getMode()->has(App\Mode::DBCONFIGAVAILABLE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -139,7 +141,7 @@ class PConfig extends BaseObject
|
|||
public static function delete($uid, $family, $key)
|
||||
{
|
||||
// Database isn't ready or populated yet
|
||||
if (!App\Mode::has(App\Mode::DBCONFIGAVAILABLE)) {
|
||||
if (!self::getApp()->getMode()->has(App\Mode::DBCONFIGAVAILABLE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue