Fix unit tests

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2021-04-19 14:06:34 +02:00
parent 56ae87c281
commit df47445c01
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
25 changed files with 98 additions and 93 deletions

View File

@ -187,7 +187,7 @@ abstract class TestCase extends \Test\TestCase {
$userObject = $userManager->createUser($user, $password);
$group = $groupManager->createGroup('group');
if ($group and $userObject) {
if ($group && $userObject) {
$group->addUser($userObject);
}
}

View File

@ -93,7 +93,7 @@ try {
\OC::$server->getConfig(),
\OC::$server->getEventDispatcher(),
\OC::$server->getRequest(),
\OC::$server->getLogger(),
\OC::$server->get(\Psr\Log\LoggerInterface::class),
\OC::$server->query(\OC\MemoryInfo::class)
);
$application->loadCommands(new ArgvInput(), new ConsoleOutput());

View File

@ -37,6 +37,7 @@ use OC\Installer;
use OC\Setup;
use OC\SystemConfig;
use OCP\Defaults;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
@ -85,7 +86,7 @@ class Install extends Command {
$this->iniGetWrapper,
$server->getL10N('lib'),
$server->query(Defaults::class),
$server->getLogger(),
$server->get(LoggerInterface::class),
$server->getSecureRandom(),
\OC::$server->query(Installer::class)
);

View File

@ -175,13 +175,12 @@ class Coordinator {
$application->boot($context);
}
} catch (QueryException $e) {
$this->logger->logException($e, [
'message' => "Could not boot $appId" . $e->getMessage(),
$this->logger->error("Could not boot $appId" . $e->getMessage(), [
'exception' => $e,
]);
} catch (Throwable $e) {
$this->logger->logException($e, [
'message' => "Could not boot $appId" . $e->getMessage(),
'level' => ILogger::FATAL,
$this->logger->emergency("Could not boot $appId" . $e->getMessage(), [
'exception' => $e,
]);
}
}

View File

@ -241,7 +241,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
$c->get(IControllerMethodReflector::class),
$c->get(INavigationManager::class),
$c->get(IURLGenerator::class),
$server->query(ILogger::class),
$server->get(LoggerInterface::class),
$c->get('AppName'),
$server->getUserSession()->isLoggedIn(),
$this->getUserId() !== null && $server->getGroupManager()->isAdmin($this->getUserId()),

View File

@ -145,6 +145,7 @@ use OC\Template\JSCombiner;
use OCA\Theming\ImageManager;
use OCA\Theming\ThemingDefaults;
use OCA\Theming\Util;
use OCA\WorkflowEngine\Service\Logger;
use OCP\Accounts\IAccountManager;
use OCP\App\IAppManager;
use OCP\Authentication\LoginCredentials\IStore;
@ -731,7 +732,7 @@ class Server extends ServerContainer implements IServerContainer {
$c->get(\OC\User\Manager::class),
$c->getAppDataDir('avatar'),
$c->getL10N('lib'),
$c->get(ILogger::class),
$c->get(LoggerInterface::class),
$c->get(\OCP\IConfig::class),
$c->get(IAccountManager::class),
$c->get(KnownUserService::class)
@ -877,7 +878,7 @@ class Server extends ServerContainer implements IServerContainer {
$c->get(IGroupManager::class),
$c->get(ICacheFactory::class),
$c->get(SymfonyAdapter::class),
$c->get(ILogger::class)
$c->get(LoggerInterface::class)
);
});
/** @deprecated 19.0.0 */
@ -1091,7 +1092,7 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerDeprecatedAlias('NotificationManager', \OCP\Notification\IManager::class);
$this->registerService(CapabilitiesManager::class, function (ContainerInterface $c) {
$manager = new CapabilitiesManager($c->get(ILogger::class));
$manager = new CapabilitiesManager($c->get(LoggerInterface::class));
$manager->registerCapability(function () use ($c) {
return new \OC\OCS\CoreCapabilities($c->get(\OCP\IConfig::class));
});
@ -1334,7 +1335,7 @@ class Server extends ServerContainer implements IServerContainer {
$c->get(AppFetcher::class),
$c->get(IClientService::class),
$c->get(ITempManager::class),
$c->get(ILogger::class),
$c->get(LoggerInterface::class),
$c->get(\OCP\IConfig::class),
\OC::$CLI
);

View File

@ -747,10 +747,10 @@ class OC_Util {
$config,
\OC::$server->get(IniGetWrapper::class),
\OC::$server->getL10N('lib'),
\OC::$server->query(\OCP\Defaults::class),
\OC::$server->getLogger(),
\OC::$server->get(\OCP\Defaults::class),
\OC::$server->get(LoggerInterface::class),
\OC::$server->getSecureRandom(),
\OC::$server->query(\OC\Installer::class)
\OC::$server->get(\OC\Installer::class)
);
$urlGenerator = \OC::$server->getURLGenerator();

View File

@ -20,10 +20,10 @@ use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IGroup;
use OCP\IGroupManager;
use OCP\ILogger;
use OCP\IUser;
use OCP\IUserSession;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\TestCase;
@ -93,7 +93,7 @@ class AppManagerTest extends TestCase {
/** @var EventDispatcherInterface|MockObject */
protected $eventDispatcher;
/** @var ILogger|MockObject */
/** @var LoggerInterface|MockObject */
protected $logger;
/** @var IAppManager */
@ -109,7 +109,7 @@ class AppManagerTest extends TestCase {
$this->cacheFactory = $this->createMock(ICacheFactory::class);
$this->cache = $this->createMock(ICache::class);
$this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->cacheFactory->expects($this->any())
->method('createDistributed')
->with('settings')

View File

@ -34,7 +34,7 @@ use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
use OCP\IConfig;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use Test\TestCase;
class AppFetcherTest extends TestCase {
@ -48,7 +48,7 @@ class AppFetcherTest extends TestCase {
protected $config;
/** @var CompareVersion|\PHPUnit\Framework\MockObject\MockObject */
protected $compareVersion;
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
/** @var AppFetcher */
protected $fetcher;
@ -1848,7 +1848,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->config = $this->createMock(IConfig::class);
$this->compareVersion = new CompareVersion();
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->fetcher = new AppFetcher(
$factory,

View File

@ -33,7 +33,7 @@ use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
use OCP\IConfig;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use Test\TestCase;
abstract class FetcherBase extends TestCase {
@ -47,7 +47,7 @@ abstract class FetcherBase extends TestCase {
protected $timeFactory;
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
/** @var Fetcher */
protected $fetcher;
@ -67,7 +67,7 @@ abstract class FetcherBase extends TestCase {
$this->clientService = $this->createMock(IClientService::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->config = $this->createMock(IConfig::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
}
public function testGetWithAlreadyExistingFileAndUpToDateTimestampAndVersion() {

View File

@ -35,9 +35,9 @@ use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\AppFramework\QueryException;
use OCP\Dashboard\IManager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\ILogger;
use OCP\IServerContainer;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;
class CoordinatorTest extends TestCase {
@ -57,7 +57,7 @@ class CoordinatorTest extends TestCase {
/** @var IEventDispatcher|MockObject */
private $eventDispatcher;
/** @var ILogger|MockObject */
/** @var LoggerInterface|MockObject */
private $logger;
/** @var Coordinator */
@ -71,7 +71,7 @@ class CoordinatorTest extends TestCase {
$this->crashReporterRegistry = $this->createMock(Registry::class);
$this->dashboardManager = $this->createMock(IManager::class);
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->coordinator = new Coordinator(
$this->serverContainer,

View File

@ -29,13 +29,13 @@ use OC\AppFramework\Bootstrap\RegistrationContext;
use OCP\AppFramework\App;
use OCP\AppFramework\IAppContainer;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\ILogger;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;
class RegistrationContextTest extends TestCase {
/** @var ILogger|MockObject */
/** @var LoggerInterface|MockObject */
private $logger;
/** @var RegistrationContext */
@ -44,7 +44,7 @@ class RegistrationContextTest extends TestCase {
protected function setUp(): void {
parent::setUp();
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->context = new RegistrationContext(
$this->logger

View File

@ -39,11 +39,11 @@ use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\IL10N;
use OCP\ILogger;
use OCP\INavigationManager;
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\Security\ISecureRandom;
use Psr\Log\LoggerInterface;
class SecurityMiddlewareTest extends \Test\TestCase {
@ -59,7 +59,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
private $request;
/** @var ControllerMethodReflector */
private $reader;
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
/** @var INavigationManager|\PHPUnit\Framework\MockObject\MockObject */
private $navigationManager;
@ -75,7 +75,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->controller = $this->createMock(Controller::class);
$this->reader = new ControllerMethodReflector();
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->navigationManager = $this->createMock(INavigationManager::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->request = $this->createMock(IRequest::class);

View File

@ -13,6 +13,7 @@ use OC\App\AppManager;
use OC\App\InfoParser;
use OC\AppConfig;
use OCP\IAppConfig;
use Psr\Log\LoggerInterface;
/**
* Class AppTest
@ -477,7 +478,7 @@ class AppTest extends \Test\TestCase {
'appforgroup2' => '["group2"]',
'appforgroup12' => '["group2","group1"]',
]
);
$apps = \OC_App::getEnabledApps(false, $forceAll);
@ -512,7 +513,7 @@ class AppTest extends \Test\TestCase {
'app3' => 'yes',
'app2' => 'no',
]
);
$apps = \OC_App::getEnabledApps();
@ -554,7 +555,7 @@ class AppTest extends \Test\TestCase {
\OC::$server->getGroupManager(),
\OC::$server->getMemCacheFactory(),
\OC::$server->getEventDispatcher(),
\OC::$server->getLogger()
\OC::$server->get(LoggerInterface::class)
));
}

View File

@ -36,9 +36,9 @@ use OCP\Files\IAppData;
use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\IConfig;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IUser;
use OCP\IUserSession;
use Psr\Log\LoggerInterface;
/**
* Class AvatarManagerTest
@ -52,7 +52,7 @@ class AvatarManagerTest extends \Test\TestCase {
private $appData;
/** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
private $l10n;
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
@ -70,7 +70,7 @@ class AvatarManagerTest extends \Test\TestCase {
$this->userManager = $this->createMock(Manager::class);
$this->appData = $this->createMock(IAppData::class);
$this->l10n = $this->createMock(IL10N::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->config = $this->createMock(IConfig::class);
$this->accountManager = $this->createMock(IAccountManager::class);
$this->knownUserService = $this->createMock(KnownUserService::class);
@ -247,7 +247,7 @@ class AvatarManagerTest extends \Test\TestCase {
}
if ($expectedPlaceholder) {
$expected = new PlaceholderAvatar($folder, $user, $this->createMock(ILogger::class));
$expected = new PlaceholderAvatar($folder, $user, $this->createMock(LoggerInterface::class));
} else {
$expected = new UserAvatar($folder, $this->l10n, $user, $this->logger, $this->config);
}

View File

@ -26,8 +26,8 @@ namespace Test\Avatar;
use OC\Avatar\GuestAvatar;
use OCP\Files\SimpleFS\InMemoryFile;
use OCP\ILogger;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;
/**
@ -48,8 +48,8 @@ class GuestAvatarTest extends TestCase {
* @return void
*/
public function setupGuestAvatar() {
/* @var MockObject|ILogger $logger */
$logger = $this->getMockBuilder(ILogger::class)->getMock();
/* @var MockObject|LoggerInterface $logger */
$logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
$this->guestAvatar = new GuestAvatar('einstein', $logger);
}

View File

@ -16,7 +16,7 @@ use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\IConfig;
use OCP\IL10N;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
class UserAvatarTest extends \Test\TestCase {
/** @var Folder | \PHPUnit\Framework\MockObject\MockObject */
@ -309,7 +309,7 @@ class UserAvatarTest extends \Test\TestCase {
$this->folder,
$l,
$user,
$this->createMock(ILogger::class),
$this->createMock(LoggerInterface::class),
$this->config
);
}

View File

@ -25,19 +25,19 @@ use OC\CapabilitiesManager;
use OCP\AppFramework\QueryException;
use OCP\Capabilities\ICapability;
use OCP\Capabilities\IPublicCapability;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
class CapabilitiesManagerTest extends TestCase {
/** @var CapabilitiesManager */
private $manager;
/** @var ILogger */
/** @var LoggerInterface */
private $logger;
protected function setUp(): void {
parent::setUp();
$this->logger = $this->getMockBuilder(ILogger::class)->getMock();
$this->logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
$this->manager = new CapabilitiesManager($this->logger);
}
@ -139,7 +139,7 @@ class CapabilitiesManagerTest extends TestCase {
]
]
];
$this->assertEquals($expected, $res);
}

View File

@ -33,25 +33,26 @@ use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
use OCP\IConfig;
use OCP\ILogger;
use OCP\IUser;
use OCP\IUserSession;
use OCP\Share\IShare;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;
class LookupPluginTest extends TestCase {
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
/** @var IConfig|MockObject */
protected $config;
/** @var IClientService|\PHPUnit\Framework\MockObject\MockObject */
/** @var IClientService|MockObject */
protected $clientService;
/** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
/** @var IUserSession|MockObject */
protected $userSession;
/** @var ICloudIdManager|\PHPUnit\Framework\MockObject\MockObject */
/** @var ICloudIdManager|MockObject */
protected $cloudIdManager;
/** @var LookupPlugin */
protected $plugin;
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|MockObject */
protected $logger;
protected function setUp(): void {
@ -60,7 +61,7 @@ class LookupPluginTest extends TestCase {
$this->userSession = $this->createMock(IUserSession::class);
$this->cloudIdManager = $this->createMock(ICloudIdManager::class);
$this->config = $this->createMock(IConfig::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->clientService = $this->createMock(IClientService::class);
$cloudId = $this->createMock(ICloudId::class);
$cloudId->expects($this->any())->method('getRemote')->willReturn('myNextcloud.net');
@ -108,7 +109,7 @@ class LookupPluginTest extends TestCase {
$this->clientService->expects($this->never())
->method('newClient');
/** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
/** @var ISearchResult|MockObject $searchResult */
$searchResult = $this->createMock(ISearchResult::class);
$this->plugin->search('foobar', 10, 0, $searchResult);
@ -132,7 +133,7 @@ class LookupPluginTest extends TestCase {
$this->clientService->expects($this->never())
->method('newClient');
/** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
/** @var ISearchResult|MockObject $searchResult */
$searchResult = $this->createMock(ISearchResult::class);
$this->plugin->search('foobar', 10, 0, $searchResult);
@ -145,7 +146,7 @@ class LookupPluginTest extends TestCase {
public function testSearch(array $searchParams) {
$type = new SearchResultType('lookup');
/** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
/** @var ISearchResult|MockObject $searchResult */
$searchResult = $this->createMock(ISearchResult::class);
$searchResult->expects($this->once())
->method('addResultSet')
@ -207,7 +208,7 @@ class LookupPluginTest extends TestCase {
public function testSearchEnableDisableLookupServer(array $searchParams, $GSEnabled, $LookupEnabled) {
$type = new SearchResultType('lookup');
/** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
/** @var ISearchResult|MockObject $searchResult */
$searchResult = $this->createMock(ISearchResult::class);
$this->config->expects($this->once())
@ -269,7 +270,7 @@ class LookupPluginTest extends TestCase {
->with('files_sharing', 'lookupServerEnabled', 'yes')
->willReturn('no');
/** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
/** @var ISearchResult|MockObject $searchResult */
$searchResult = $this->createMock(ISearchResult::class);
$searchResult->expects($this->never())
->method('addResultSet');

View File

@ -27,12 +27,12 @@ use OC\Collaboration\Resources\Manager;
use OCP\Collaboration\Resources\IManager;
use OCP\Collaboration\Resources\IProviderManager;
use OCP\IDBConnection;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use Test\TestCase;
class ManagerTest extends TestCase {
/** @var ILogger */
/** @var LoggerInterface */
protected $logger;
/** @var IProviderManager */
protected $providerManager;
@ -42,14 +42,14 @@ class ManagerTest extends TestCase {
protected function setUp(): void {
parent::setUp();
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->providerManager = $this->createMock(IProviderManager::class);
/** @var IDBConnection $connection */
$connection = $this->createMock(IDBConnection::class);
$this->manager = new Manager($connection, $this->providerManager, $this->logger);
}
public function testRegisterResourceProvider(): void {
$this->logger->expects($this->once())
->method('debug')

View File

@ -27,15 +27,15 @@ use OC\Collaboration\Resources\ProviderManager;
use OCA\Files\Collaboration\Resources\ResourceProvider;
use OCP\AppFramework\QueryException;
use OCP\Collaboration\Resources\IProviderManager;
use OCP\ILogger;
use OCP\IServerContainer;
use Psr\Log\LoggerInterface;
use Test\TestCase;
class ProviderManagerTest extends TestCase {
/** @var IServerContainer */
protected $serverContainer;
/** @var ILogger */
/** @var LoggerInterface */
protected $logger;
/** @var IProviderManager */
protected $providerManager;
@ -44,7 +44,7 @@ class ProviderManagerTest extends TestCase {
parent::setUp();
$this->serverContainer = $this->createMock(IServerContainer::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->providerManager = new class($this->serverContainer, $this->logger) extends ProviderManager {
public function countProviders(): int {

View File

@ -27,10 +27,10 @@ namespace Test;
use OC\AppFramework\Bootstrap\Coordinator;
use OCP\IServerContainer;
use Psr\Log\LoggerInterface;
use function json_encode;
use JsonSerializable;
use OC\InitialStateService;
use OCP\ILogger;
use stdClass;
class InitialStateServiceTest extends TestCase {
@ -42,7 +42,7 @@ class InitialStateServiceTest extends TestCase {
parent::setUp();
$this->service = new InitialStateService(
$this->createMock(ILogger::class),
$this->createMock(LoggerInterface::class),
$this->createMock(Coordinator::class),
$this->createMock(IServerContainer::class)
);

View File

@ -14,8 +14,8 @@ use OC\Installer;
use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\ILogger;
use OCP\ITempManager;
use Psr\Log\LoggerInterface;
/**
* Class InstallerTest
@ -32,7 +32,7 @@ class InstallerTest extends TestCase {
private $clientService;
/** @var ITempManager|\PHPUnit\Framework\MockObject\MockObject */
private $tempManager;
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
@ -43,7 +43,7 @@ class InstallerTest extends TestCase {
$this->appFetcher = $this->createMock(AppFetcher::class);
$this->clientService = $this->createMock(IClientService::class);
$this->tempManager = $this->createMock(ITempManager::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->config = $this->createMock(IConfig::class);
$config = \OC::$server->getConfig();
@ -53,7 +53,7 @@ class InstallerTest extends TestCase {
\OC::$server->getAppFetcher(),
\OC::$server->getHTTPClientService(),
\OC::$server->getTempManager(),
\OC::$server->getLogger(),
\OC::$server->get(LoggerInterface::class),
$config,
false
);
@ -76,7 +76,7 @@ class InstallerTest extends TestCase {
\OC::$server->getAppFetcher(),
\OC::$server->getHTTPClientService(),
\OC::$server->getTempManager(),
\OC::$server->getLogger(),
\OC::$server->get(LoggerInterface::class),
\OC::$server->getConfig(),
false
);
@ -100,7 +100,7 @@ class InstallerTest extends TestCase {
\OC::$server->getAppFetcher(),
\OC::$server->getHTTPClientService(),
\OC::$server->getTempManager(),
\OC::$server->getLogger(),
\OC::$server->get(LoggerInterface::class),
\OC::$server->getConfig(),
false
);

View File

@ -14,26 +14,27 @@ use OC\Setup;
use OC\SystemConfig;
use OCP\Defaults;
use OCP\IL10N;
use OCP\ILogger;
use OCP\Security\ISecureRandom;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
class SetupTest extends \Test\TestCase {
/** @var SystemConfig|\PHPUnit\Framework\MockObject\MockObject */
/** @var SystemConfig|MockObject */
protected $config;
/** @var \bantu\IniGetWrapper\IniGetWrapper|\PHPUnit\Framework\MockObject\MockObject */
/** @var \bantu\IniGetWrapper\IniGetWrapper|MockObject */
private $iniWrapper;
/** @var \OCP\IL10N|\PHPUnit\Framework\MockObject\MockObject */
/** @var \OCP\IL10N|MockObject */
private $l10n;
/** @var Defaults|\PHPUnit\Framework\MockObject\MockObject */
/** @var Defaults|MockObject */
private $defaults;
/** @var \OC\Setup|\PHPUnit\Framework\MockObject\MockObject */
/** @var \OC\Setup|MockObject */
protected $setupClass;
/** @var \OCP\ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|MockObject */
protected $logger;
/** @var \OCP\Security\ISecureRandom|\PHPUnit\Framework\MockObject\MockObject */
/** @var \OCP\Security\ISecureRandom|MockObject */
protected $random;
/** @var Installer|\PHPUnit\Framework\MockObject\MockObject */
/** @var Installer|MockObject */
protected $installer;
protected function setUp(): void {
@ -43,7 +44,7 @@ class SetupTest extends \Test\TestCase {
$this->iniWrapper = $this->createMock(IniGetWrapper::class);
$this->l10n = $this->createMock(IL10N::class);
$this->defaults = $this->createMock(Defaults::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->random = $this->createMock(ISecureRandom::class);
$this->installer = $this->createMock(Installer::class);
$this->setupClass = $this->getMockBuilder(Setup::class)

View File

@ -22,22 +22,23 @@
namespace Test;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use OC\Installer;
use OC\IntegrityCheck\Checker;
use OC\Updater;
use OCP\IConfig;
use OCP\ILogger;
class UpdaterTest extends TestCase {
/** @var IConfig | \PHPUnit\Framework\MockObject\MockObject */
/** @var IConfig|MockObject */
private $config;
/** @var ILogger | \PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|MockObject */
private $logger;
/** @var Updater */
private $updater;
/** @var Checker | \PHPUnit\Framework\MockObject\MockObject */
/** @var Checker|MockObject */
private $checker;
/** @var Installer|\PHPUnit\Framework\MockObject\MockObject */
/** @var Installer|MockObject */
private $installer;
protected function setUp(): void {
@ -45,7 +46,7 @@ class UpdaterTest extends TestCase {
$this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$this->logger = $this->getMockBuilder(ILogger::class)
$this->logger = $this->getMockBuilder(LoggerInterface::class)
->disableOriginalConstructor()
->getMock();
$this->checker = $this->getMockBuilder(Checker::class)