mirror of
https://github.com/friendica/friendica
synced 2024-12-22 18:00:16 +00:00
Remove unused AppDouble class
This commit is contained in:
parent
c24d36c02e
commit
4f1b917e42
2 changed files with 1 additions and 42 deletions
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
namespace Friendica\Test;
|
namespace Friendica\Test;
|
||||||
|
|
||||||
use Friendica\App;
|
|
||||||
use Friendica\Capabilities\ICanCreateResponses;
|
use Friendica\Capabilities\ICanCreateResponses;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||||
|
@ -16,7 +15,6 @@ use Friendica\DI;
|
||||||
use Friendica\Module\Special\HTTPException;
|
use Friendica\Module\Special\HTTPException;
|
||||||
use Friendica\Security\Authentication;
|
use Friendica\Security\Authentication;
|
||||||
use Friendica\Security\BasicAuth;
|
use Friendica\Security\BasicAuth;
|
||||||
use Friendica\Test\Util\AppDouble;
|
|
||||||
use Friendica\Test\Util\AuthenticationDouble;
|
use Friendica\Test\Util\AuthenticationDouble;
|
||||||
use Friendica\Test\Util\AuthTestConfig;
|
use Friendica\Test\Util\AuthTestConfig;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
@ -158,12 +156,9 @@ abstract class ApiTestCase extends FixtureTestCase
|
||||||
|
|
||||||
$this->dice = $this->dice
|
$this->dice = $this->dice
|
||||||
->addRule(Authentication::class, ['instanceOf' => AuthenticationDouble::class, 'shared' => true])
|
->addRule(Authentication::class, ['instanceOf' => AuthenticationDouble::class, 'shared' => true])
|
||||||
->addRule(App::class, ['instanceOf' => AppDouble::class, 'shared' => true]);
|
;
|
||||||
DI::init($this->dice);
|
DI::init($this->dice);
|
||||||
|
|
||||||
// Manual override to bypass API authentication
|
|
||||||
DI::app()->setIsLoggedIn(true);
|
|
||||||
|
|
||||||
$this->httpExceptionMock = $this->dice->create(HTTPException::class);
|
$this->httpExceptionMock = $this->dice->create(HTTPException::class);
|
||||||
|
|
||||||
AuthTestConfig::$authenticated = true;
|
AuthTestConfig::$authenticated = true;
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// Copyright (C) 2010-2024, the Friendica project
|
|
||||||
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
||||||
|
|
||||||
namespace Friendica\Test\Util;
|
|
||||||
|
|
||||||
use Friendica\App;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Making the App class overridable for specific situations
|
|
||||||
*
|
|
||||||
* @see App
|
|
||||||
*/
|
|
||||||
class AppDouble extends App
|
|
||||||
{
|
|
||||||
/** @var bool Marks/Overwrites if the user is currently logged in */
|
|
||||||
protected $isLoggedIn = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Manually overwrite the "isLoggedIn" behavior
|
|
||||||
*
|
|
||||||
* @param bool $isLoggedIn
|
|
||||||
*/
|
|
||||||
public function setIsLoggedIn(bool $isLoggedIn)
|
|
||||||
{
|
|
||||||
$this->isLoggedIn = $isLoggedIn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isLoggedIn(): bool
|
|
||||||
{
|
|
||||||
return $this->isLoggedIn;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue