mirror of
https://github.com/friendica/friendica
synced 2025-02-22 09:26:48 +00:00
move load() call outside of constructor to remove side effects
This commit is contained in:
parent
23e3af4a09
commit
9ef3fdc857
3 changed files with 7 additions and 8 deletions
|
@ -29,6 +29,11 @@ $dice = $dice->addRule(Friendica\App\Mode::class, ['call' => [['determineRunMode
|
|||
|
||||
$a = \Friendica\App::fromDice($dice);
|
||||
|
||||
$a->load(
|
||||
$dice->create(\Friendica\Database\Definition\DbaDefinition::class),
|
||||
$dice->create(\Friendica\Database\Definition\ViewDefinition::class),
|
||||
);
|
||||
|
||||
\Friendica\DI::mode()->setExecutor(\Friendica\App\Mode::INDEX);
|
||||
|
||||
$a->runFrontend(
|
||||
|
|
|
@ -66,8 +66,6 @@ class App
|
|||
$dice->create(L10n::class),
|
||||
$dice->create(Arguments::class),
|
||||
$dice->create(IHandleUserSessions::class),
|
||||
$dice->create(DbaDefinition::class),
|
||||
$dice->create(ViewDefinition::class),
|
||||
$dice->create(AppHelper::class)
|
||||
);
|
||||
}
|
||||
|
@ -140,8 +138,6 @@ class App
|
|||
L10n $l10n,
|
||||
Arguments $args,
|
||||
IHandleUserSessions $session,
|
||||
DbaDefinition $dbaDefinition,
|
||||
ViewDefinition $viewDefinition,
|
||||
AppHelper $appHelper,
|
||||
) {
|
||||
$this->container = $container;
|
||||
|
@ -156,14 +152,12 @@ class App
|
|||
$this->args = $args;
|
||||
$this->session = $session;
|
||||
$this->appHelper = $appHelper;
|
||||
|
||||
$this->load($dbaDefinition, $viewDefinition);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the whole app instance
|
||||
*/
|
||||
protected function load(DbaDefinition $dbaDefinition, ViewDefinition $viewDefinition)
|
||||
public function load(DbaDefinition $dbaDefinition, ViewDefinition $viewDefinition)
|
||||
{
|
||||
if ($this->config->get('system', 'ini_max_execution_time') !== false) {
|
||||
set_time_limit((int)$this->config->get('system', 'ini_max_execution_time'));
|
||||
|
|
|
@ -18,7 +18,7 @@ class AppTest extends TestCase
|
|||
public function testFromDiceReturnsApp(): void
|
||||
{
|
||||
$dice = $this->createMock(Dice::class);
|
||||
$dice->expects($this->exactly(13))->method('create')->willReturnCallback(function($classname) {
|
||||
$dice->expects($this->exactly(11))->method('create')->willReturnCallback(function($classname) {
|
||||
return $this->createMock($classname);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue