Fix recursive calls in logging via server methods

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2020-03-18 10:43:54 +01:00 committed by Roeland Jago Douma
parent 570f3c7798
commit dc7913efcd
No known key found for this signature in database
GPG Key ID: F941078878347C0C
5 changed files with 208 additions and 172 deletions

View File

@ -26,6 +26,7 @@
namespace OCA\Settings\Tests\AppInfo; namespace OCA\Settings\Tests\AppInfo;
use OC\User\Session;
use OCA\Settings\AppInfo\Application; use OCA\Settings\AppInfo\Application;
use OCA\Settings\Controller\AdminSettingsController; use OCA\Settings\Controller\AdminSettingsController;
use OCA\Settings\Controller\AppSettingsController; use OCA\Settings\Controller\AppSettingsController;
@ -113,8 +114,8 @@ class ApplicationTest extends TestCase {
->method('getUser') ->method('getUser')
->willReturn($user); ->willReturn($user);
$this->overwriteService('UserSession', $session); $this->overwriteService(Session::class, $session);
$this->assertTrue($this->container->query($service) instanceof $expected); $this->assertTrue($this->container->query($service) instanceof $expected);
$this->restoreService('UserSession'); $this->restoreService(Session::class);
} }
} }

View File

@ -53,19 +53,12 @@ class DefaultTokenProvider implements IProvider {
/** @var IConfig */ /** @var IConfig */
private $config; private $config;
/** @var ILogger $logger */ /** @var ILogger */
private $logger; private $logger;
/** @var ITimeFactory $time */ /** @var ITimeFactory */
private $time; private $time;
/**
* @param DefaultTokenMapper $mapper
* @param ICrypto $crypto
* @param IConfig $config
* @param ILogger $logger
* @param ITimeFactory $time
*/
public function __construct(DefaultTokenMapper $mapper, public function __construct(DefaultTokenMapper $mapper,
ICrypto $crypto, ICrypto $crypto,
IConfig $config, IConfig $config,

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,7 @@
namespace Test; namespace Test;
use OC\App\AppManager;
use OC\App\InfoParser; use OC\App\InfoParser;
use OC\AppConfig; use OC\AppConfig;
use OCP\IAppConfig; use OCP\IAppConfig;
@ -546,8 +547,8 @@ class AppTest extends \Test\TestCase {
* @param IAppConfig $appConfig app config mock * @param IAppConfig $appConfig app config mock
*/ */
private function registerAppConfig(AppConfig $appConfig) { private function registerAppConfig(AppConfig $appConfig) {
$this->overwriteService('AppConfig', $appConfig); $this->overwriteService(AppConfig::class, $appConfig);
$this->overwriteService('AppManager', new \OC\App\AppManager( $this->overwriteService(AppManager::class, new \OC\App\AppManager(
\OC::$server->getUserSession(), \OC::$server->getUserSession(),
\OC::$server->getConfig(), \OC::$server->getConfig(),
$appConfig, $appConfig,
@ -562,8 +563,8 @@ class AppTest extends \Test\TestCase {
* Restore the original app config service. * Restore the original app config service.
*/ */
private function restoreAppConfig() { private function restoreAppConfig() {
$this->restoreService('AppConfig'); $this->restoreService(AppConfig::class);
$this->restoreService('AppManager'); $this->restoreService(AppManager::class);
// Remove the cache of the mocked apps list with a forceRefresh // Remove the cache of the mocked apps list with a forceRefresh
\OC_App::getEnabledApps(); \OC_App::getEnabledApps();

View File

@ -559,15 +559,15 @@ class UserTest extends TestCase {
->method('markProcessed'); ->method('markProcessed');
} }
$this->overwriteService('NotificationManager', $notificationManager); $this->overwriteService(\OCP\Notification\IManager::class, $notificationManager);
$this->overwriteService('CommentsManager', $commentsManager); $this->overwriteService(\OCP\Comments\ICommentsManager::class, $commentsManager);
$this->overwriteService(AllConfig::class, $config); $this->overwriteService(AllConfig::class, $config);
$this->assertSame($result, $user->delete()); $this->assertSame($result, $user->delete());
$this->restoreService(AllConfig::class); $this->restoreService(AllConfig::class);
$this->restoreService('CommentsManager'); $this->restoreService(\OCP\Comments\ICommentsManager::class);
$this->restoreService('NotificationManager'); $this->restoreService(\OCP\Notification\IManager::class);
$this->assertEquals($expectedHooks, $hooksCalled); $this->assertEquals($expectedHooks, $hooksCalled);
} }