Merge pull request #20013 from nextcloud/bugfix/noid/fix-recursive-calls-in-logging-via-methods

Fix recursive calls in logging via server methods
This commit is contained in:
Roeland Jago Douma 2020-03-18 20:47:06 +01:00 committed by GitHub
commit 3e64be7b6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 208 additions and 172 deletions

View File

@ -26,6 +26,7 @@
namespace OCA\Settings\Tests\AppInfo;
use OC\User\Session;
use OCA\Settings\AppInfo\Application;
use OCA\Settings\Controller\AdminSettingsController;
use OCA\Settings\Controller\AppSettingsController;
@ -113,8 +114,8 @@ class ApplicationTest extends TestCase {
->method('getUser')
->willReturn($user);
$this->overwriteService('UserSession', $session);
$this->overwriteService(Session::class, $session);
$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 */
private $config;
/** @var ILogger $logger */
/** @var ILogger */
private $logger;
/** @var ITimeFactory $time */
/** @var ITimeFactory */
private $time;
/**
* @param DefaultTokenMapper $mapper
* @param ICrypto $crypto
* @param IConfig $config
* @param ILogger $logger
* @param ITimeFactory $time
*/
public function __construct(DefaultTokenMapper $mapper,
ICrypto $crypto,
IConfig $config,

File diff suppressed because it is too large Load Diff

View File

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

View File

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