mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #60299 from nextcloud/fix/remove-iservercontainer-from-core-apps
Chore: Remove references to deprecated interface IServerContainer
This commit is contained in:
commit
ac15544703
42 changed files with 168 additions and 319 deletions
|
|
@ -98,8 +98,12 @@ class NodeTest extends \Test\TestCase {
|
|||
->method('getRelativePath')
|
||||
->with(null)
|
||||
->willReturn('');
|
||||
$view
|
||||
->method('getAbsolutePath')
|
||||
->with(null)
|
||||
->willReturn('');
|
||||
|
||||
$node = new File($view, $info);
|
||||
$node = new File($view, $info);
|
||||
$this->assertEquals($expected, $node->getDavPermissions());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ use OCA\Files\Capabilities;
|
|||
use OCA\Files\Collaboration\Resources\Listener;
|
||||
use OCA\Files\Collaboration\Resources\ResourceProvider;
|
||||
use OCA\Files\ConfigLexicon;
|
||||
use OCA\Files\Controller\ApiController;
|
||||
use OCA\Files\Dashboard\FavoriteWidget;
|
||||
use OCA\Files\DirectEditingCapabilities;
|
||||
use OCA\Files\Event\LoadSearchPlugins;
|
||||
|
|
@ -28,10 +27,6 @@ use OCA\Files\Listener\SyncLivePhotosListener;
|
|||
use OCA\Files\Listener\UserFirstTimeLoggedInListener;
|
||||
use OCA\Files\Notification\Notifier;
|
||||
use OCA\Files\Search\FilesSearchProvider;
|
||||
use OCA\Files\Service\TagService;
|
||||
use OCA\Files\Service\UserConfig;
|
||||
use OCA\Files\Service\ViewConfig;
|
||||
use OCP\Activity\IManager as IActivityManager;
|
||||
use OCP\AppFramework\App;
|
||||
use OCP\AppFramework\Bootstrap\IBootContext;
|
||||
use OCP\AppFramework\Bootstrap\IBootstrap;
|
||||
|
|
@ -45,19 +40,8 @@ use OCP\Files\Events\Node\BeforeNodeRenamedEvent;
|
|||
use OCP\Files\Events\Node\NodeCopiedEvent;
|
||||
use OCP\Files\Events\NodeAddedToFavorite;
|
||||
use OCP\Files\Events\NodeRemovedFromFavorite;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\IPreview;
|
||||
use OCP\IRequest;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\ITagManager;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Share\IManager as IShareManager;
|
||||
use OCP\User\Events\UserFirstTimeLoggedInEvent;
|
||||
use OCP\Util;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Application extends App implements IBootstrap {
|
||||
public const APP_ID = 'files';
|
||||
|
|
@ -68,45 +52,6 @@ class Application extends App implements IBootstrap {
|
|||
|
||||
#[\Override]
|
||||
public function register(IRegistrationContext $context): void {
|
||||
/**
|
||||
* Controllers
|
||||
*/
|
||||
$context->registerService('APIController', function (ContainerInterface $c) {
|
||||
/** @var IServerContainer $server */
|
||||
$server = $c->get(IServerContainer::class);
|
||||
|
||||
return new ApiController(
|
||||
$c->get('AppName'),
|
||||
$c->get(IRequest::class),
|
||||
$c->get(IUserSession::class),
|
||||
$c->get(TagService::class),
|
||||
$c->get(IPreview::class),
|
||||
$c->get(IShareManager::class),
|
||||
$c->get(IConfig::class),
|
||||
$server->getUserFolder(),
|
||||
$c->get(UserConfig::class),
|
||||
$c->get(ViewConfig::class),
|
||||
$c->get(IL10N::class),
|
||||
$c->get(IRootFolder::class),
|
||||
$c->get(LoggerInterface::class),
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Services
|
||||
*/
|
||||
$context->registerService(TagService::class, function (ContainerInterface $c) {
|
||||
/** @var IServerContainer $server */
|
||||
$server = $c->get(IServerContainer::class);
|
||||
|
||||
return new TagService(
|
||||
$c->get(IUserSession::class),
|
||||
$c->get(IActivityManager::class),
|
||||
$c->get(ITagManager::class)->load(self::APP_ID),
|
||||
$server->getUserFolder(),
|
||||
);
|
||||
});
|
||||
|
||||
/*
|
||||
* Register capabilities
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ use Throwable;
|
|||
* @package OCA\Files\Controller
|
||||
*/
|
||||
class ApiController extends Controller {
|
||||
private ?Folder $userFolder = null;
|
||||
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IRequest $request,
|
||||
|
|
@ -61,7 +63,6 @@ class ApiController extends Controller {
|
|||
private IPreview $previewManager,
|
||||
private IManager $shareManager,
|
||||
private IConfig $config,
|
||||
private ?Folder $userFolder,
|
||||
private UserConfig $userConfig,
|
||||
private ViewConfig $viewConfig,
|
||||
private IL10N $l10n,
|
||||
|
|
@ -69,6 +70,10 @@ class ApiController extends Controller {
|
|||
private LoggerInterface $logger,
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
$user = $this->userSession->getUser();
|
||||
if ($user) {
|
||||
$this->userFolder = $this->rootFolder->getUserFolder($user->getUID());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -7,9 +7,12 @@
|
|||
*/
|
||||
namespace OCA\Files\Service;
|
||||
|
||||
use OCA\Files\AppInfo\Application;
|
||||
use OCP\Activity\IManager;
|
||||
use OCP\Files\Folder;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\ITagManager;
|
||||
use OCP\ITags;
|
||||
use OCP\IUserSession;
|
||||
|
||||
|
|
@ -17,13 +20,20 @@ use OCP\IUserSession;
|
|||
* Service class to manage tags on files.
|
||||
*/
|
||||
class TagService {
|
||||
private ?Folder $homeFolder = null;
|
||||
private ?ITags $tagger;
|
||||
|
||||
public function __construct(
|
||||
private IUserSession $userSession,
|
||||
private IManager $activityManager,
|
||||
private ?ITags $tagger,
|
||||
private ?Folder $homeFolder,
|
||||
ITagManager $tagManager,
|
||||
IRootFolder $rootFolder,
|
||||
) {
|
||||
$user = $this->userSession->getUser();
|
||||
if ($user) {
|
||||
$this->homeFolder = $rootFolder->getUserFolder($user->getUID());
|
||||
}
|
||||
$this->tagger = $tagManager->load(Application::APP_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -77,6 +77,9 @@ class ApiControllerTest extends TestCase {
|
|||
$this->viewConfig = $this->createMock(ViewConfig::class);
|
||||
$this->l10n = $this->createMock(IL10N::class);
|
||||
$this->rootFolder = $this->createMock(IRootFolder::class);
|
||||
$this->rootFolder->expects($this->any())
|
||||
->method('getUserFolder')
|
||||
->willReturn($this->userFolder);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
|
||||
$this->apiController = new ApiController(
|
||||
|
|
@ -87,7 +90,6 @@ class ApiControllerTest extends TestCase {
|
|||
$this->preview,
|
||||
$this->shareManager,
|
||||
$this->config,
|
||||
$this->userFolder,
|
||||
$this->userConfig,
|
||||
$this->viewConfig,
|
||||
$this->l10n,
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@ class TagServiceTest extends \Test\TestCase {
|
|||
\OC_User::setUserId($this->user);
|
||||
\OC_Util::setupFS($this->user);
|
||||
$user = $this->createMock(IUser::class);
|
||||
$user->expects($this->any())
|
||||
->method('getUID')
|
||||
->willReturn($this->user);
|
||||
$this->userSession = $this->createMock(IUserSession::class);
|
||||
$this->userSession->expects($this->any())
|
||||
->method('getUser')
|
||||
|
|
@ -61,8 +64,8 @@ class TagServiceTest extends \Test\TestCase {
|
|||
->setConstructorArgs([
|
||||
$this->userSession,
|
||||
$this->activityManager,
|
||||
$this->tagger,
|
||||
$this->root,
|
||||
Server::get(ITagManager::class),
|
||||
Server::get(IRootFolder::class),
|
||||
])
|
||||
->onlyMethods($methods)
|
||||
->getMock();
|
||||
|
|
@ -91,16 +94,22 @@ class TagServiceTest extends \Test\TestCase {
|
|||
// set tags
|
||||
$this->tagService->updateFileTags('subdir/test.txt', [$tag1, $tag2]);
|
||||
|
||||
// Sync to reload tags
|
||||
$this->tagger->addMultiple([], sync:true);
|
||||
$this->assertEquals([$fileId], $this->tagger->getIdsForTag($tag1));
|
||||
$this->assertEquals([$fileId], $this->tagger->getIdsForTag($tag2));
|
||||
|
||||
// remove tag
|
||||
$this->tagService->updateFileTags('subdir/test.txt', [$tag2]);
|
||||
// Sync to reload tags
|
||||
$this->tagger->addMultiple([], sync:true);
|
||||
$this->assertEquals([], $this->tagger->getIdsForTag($tag1));
|
||||
$this->assertEquals([$fileId], $this->tagger->getIdsForTag($tag2));
|
||||
|
||||
// clear tags
|
||||
$this->tagService->updateFileTags('subdir/test.txt', []);
|
||||
// Sync to reload tags
|
||||
$this->tagger->addMultiple([], sync:true);
|
||||
$this->assertEquals([], $this->tagger->getIdsForTag($tag1));
|
||||
$this->assertEquals([], $this->tagger->getIdsForTag($tag2));
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@
|
|||
*/
|
||||
namespace OCA\Files_Versions\AppInfo;
|
||||
|
||||
use OC\KnownUser\KnownUserService;
|
||||
use OCA\DAV\CalDAV\Proxy\ProxyMapper;
|
||||
use OCA\DAV\Connector\Sabre\Principal;
|
||||
use OCA\Files\Event\LoadAdditionalScriptsEvent;
|
||||
use OCA\Files\Event\LoadSidebar;
|
||||
|
|
@ -22,7 +20,6 @@ use OCA\Files_Versions\Listener\VersionAuthorListener;
|
|||
use OCA\Files_Versions\Listener\VersionStorageMoveListener;
|
||||
use OCA\Files_Versions\Versions\IVersionManager;
|
||||
use OCA\Files_Versions\Versions\VersionManager;
|
||||
use OCP\Accounts\IAccountManager;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\AppFramework\App;
|
||||
use OCP\AppFramework\Bootstrap\IBootContext;
|
||||
|
|
@ -39,14 +36,6 @@ use OCP\Files\Events\Node\NodeDeletedEvent;
|
|||
use OCP\Files\Events\Node\NodeRenamedEvent;
|
||||
use OCP\Files\Events\Node\NodeTouchedEvent;
|
||||
use OCP\Files\Events\Node\NodeWrittenEvent;
|
||||
use OCP\IConfig;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IUserSession;
|
||||
use OCP\L10N\IFactory;
|
||||
use OCP\Server;
|
||||
use OCP\Share\IManager as IShareManager;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
|
|
@ -67,22 +56,7 @@ class Application extends App implements IBootstrap {
|
|||
/**
|
||||
* Register $principalBackend for the DAV collection
|
||||
*/
|
||||
$context->registerService('principalBackend', function (ContainerInterface $c) {
|
||||
/** @var IServerContainer $server */
|
||||
$server = $c->get(IServerContainer::class);
|
||||
return new Principal(
|
||||
$server->get(IUserManager::class),
|
||||
$server->get(IGroupManager::class),
|
||||
Server::get(IAccountManager::class),
|
||||
$server->get(IShareManager::class),
|
||||
$server->get(IUserSession::class),
|
||||
$server->get(IAppManager::class),
|
||||
$server->get(ProxyMapper::class),
|
||||
$server->get(KnownUserService::class),
|
||||
$server->get(IConfig::class),
|
||||
$server->get(IFactory::class),
|
||||
);
|
||||
});
|
||||
$context->registerServiceAlias('principalBackend', Principal::class);
|
||||
|
||||
$context->registerServiceAlias(IVersionManager::class, VersionManager::class);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ return array(
|
|||
'OCA\\Provisioning_API\\Controller\\PreferencesController' => $baseDir . '/../lib/Controller/PreferencesController.php',
|
||||
'OCA\\Provisioning_API\\Controller\\UsersController' => $baseDir . '/../lib/Controller/UsersController.php',
|
||||
'OCA\\Provisioning_API\\Controller\\VerificationController' => $baseDir . '/../lib/Controller/VerificationController.php',
|
||||
'OCA\\Provisioning_API\\FederatedShareProviderFactory' => $baseDir . '/../lib/FederatedShareProviderFactory.php',
|
||||
'OCA\\Provisioning_API\\Listener\\UserDeletedListener' => $baseDir . '/../lib/Listener/UserDeletedListener.php',
|
||||
'OCA\\Provisioning_API\\Middleware\\Exceptions\\NotSubAdminException' => $baseDir . '/../lib/Middleware/Exceptions/NotSubAdminException.php',
|
||||
'OCA\\Provisioning_API\\Middleware\\ProvisioningApiMiddleware' => $baseDir . '/../lib/Middleware/ProvisioningApiMiddleware.php',
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ class ComposerStaticInitProvisioning_API
|
|||
'OCA\\Provisioning_API\\Controller\\PreferencesController' => __DIR__ . '/..' . '/../lib/Controller/PreferencesController.php',
|
||||
'OCA\\Provisioning_API\\Controller\\UsersController' => __DIR__ . '/..' . '/../lib/Controller/UsersController.php',
|
||||
'OCA\\Provisioning_API\\Controller\\VerificationController' => __DIR__ . '/..' . '/../lib/Controller/VerificationController.php',
|
||||
'OCA\\Provisioning_API\\FederatedShareProviderFactory' => __DIR__ . '/..' . '/../lib/FederatedShareProviderFactory.php',
|
||||
'OCA\\Provisioning_API\\Listener\\UserDeletedListener' => __DIR__ . '/..' . '/../lib/Listener/UserDeletedListener.php',
|
||||
'OCA\\Provisioning_API\\Middleware\\Exceptions\\NotSubAdminException' => __DIR__ . '/..' . '/../lib/Middleware/Exceptions/NotSubAdminException.php',
|
||||
'OCA\\Provisioning_API\\Middleware\\ProvisioningApiMiddleware' => __DIR__ . '/..' . '/../lib/Middleware/ProvisioningApiMiddleware.php',
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
namespace OCA\Provisioning_API;
|
||||
|
||||
use OCA\FederatedFileSharing\FederatedShareProvider;
|
||||
use OCP\IServerContainer;
|
||||
|
||||
class FederatedShareProviderFactory {
|
||||
|
||||
public function __construct(
|
||||
private IServerContainer $serverContainer,
|
||||
) {
|
||||
}
|
||||
|
||||
public function get(): FederatedShareProvider {
|
||||
return $this->serverContainer->query(FederatedShareProvider::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -1409,14 +1409,8 @@
|
|||
</TypeDoesNotContainType>
|
||||
</file>
|
||||
<file src="apps/files/lib/AppInfo/Application.php">
|
||||
<DeprecatedInterface>
|
||||
<code><![CDATA[$server]]></code>
|
||||
<code><![CDATA[$server]]></code>
|
||||
</DeprecatedInterface>
|
||||
<DeprecatedMethod>
|
||||
<code><![CDATA[Util::connectHook('\OCP\Config', 'js', '\OCA\Files\App', 'extendJsConfig')]]></code>
|
||||
<code><![CDATA[getUserFolder]]></code>
|
||||
<code><![CDATA[getUserFolder]]></code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="apps/files/lib/BackgroundJob/ScanFiles.php">
|
||||
|
|
@ -2046,9 +2040,6 @@
|
|||
<DeprecatedClass>
|
||||
<code><![CDATA[LegacyRollbackListener::class]]></code>
|
||||
</DeprecatedClass>
|
||||
<DeprecatedInterface>
|
||||
<code><![CDATA[$server]]></code>
|
||||
</DeprecatedInterface>
|
||||
</file>
|
||||
<file src="apps/files_versions/lib/BackgroundJob/ExpireVersions.php">
|
||||
<DeprecatedClass>
|
||||
|
|
@ -2296,14 +2287,6 @@
|
|||
<code><![CDATA[$groupid === null]]></code>
|
||||
</TypeDoesNotContainNull>
|
||||
</file>
|
||||
<file src="apps/provisioning_api/lib/FederatedShareProviderFactory.php">
|
||||
<DeprecatedInterface>
|
||||
<code><![CDATA[private]]></code>
|
||||
</DeprecatedInterface>
|
||||
<DeprecatedMethod>
|
||||
<code><![CDATA[query]]></code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="apps/provisioning_api/lib/Middleware/ProvisioningApiMiddleware.php">
|
||||
<DeprecatedMethod>
|
||||
<code><![CDATA[hasAnnotation]]></code>
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ use OCP\AppFramework\QueryException;
|
|||
use OCP\Dashboard\IManager;
|
||||
use OCP\Diagnostics\IEventLogger;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\IServerContainer;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Throwable;
|
||||
use function class_exists;
|
||||
|
|
@ -35,7 +35,7 @@ class Coordinator {
|
|||
private array $bootedApps = [];
|
||||
|
||||
public function __construct(
|
||||
private IServerContainer $serverContainer,
|
||||
private ContainerInterface $serverContainer,
|
||||
private Registry $registry,
|
||||
private IManager $dashboardManager,
|
||||
private IEventDispatcher $eventDispatcher,
|
||||
|
|
@ -99,7 +99,7 @@ class Coordinator {
|
|||
$this->eventLogger->start("bootstrap:register_app:$appId:application", "Load `Application` instance for $appId");
|
||||
try {
|
||||
/** @var IBootstrap&App $application */
|
||||
$application = $this->serverContainer->query($applicationClassName);
|
||||
$application = $this->serverContainer->get($applicationClassName);
|
||||
$apps[$appId] = $application;
|
||||
} catch (ContainerExceptionInterface $e) {
|
||||
// Weird, but ok
|
||||
|
|
@ -162,10 +162,8 @@ class Coordinator {
|
|||
*/
|
||||
$this->eventLogger->start('bootstrap:boot_app:' . $appId, "Call `Application::boot` for $appId");
|
||||
try {
|
||||
/** @var App $application */
|
||||
$application = $this->serverContainer->query($applicationClassName);
|
||||
if ($application instanceof IBootstrap) {
|
||||
/** @var BootContext $context */
|
||||
$application = $this->serverContainer->get($applicationClassName);
|
||||
if ($application instanceof IBootstrap && $application instanceof App) {
|
||||
$context = new BootContext($application->getContainer());
|
||||
$application->boot($context);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use OC\Calendar\ResourcesRoomsUpdater;
|
|||
use OCP\AppFramework\QueryException;
|
||||
use OCP\Calendar\Resource\IBackend;
|
||||
use OCP\Calendar\Resource\IManager;
|
||||
use OCP\IServerContainer;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
class Manager implements IManager {
|
||||
private bool $bootstrapBackendsLoaded = false;
|
||||
|
|
@ -29,7 +29,7 @@ class Manager implements IManager {
|
|||
|
||||
public function __construct(
|
||||
private Coordinator $bootstrapCoordinator,
|
||||
private IServerContainer $server,
|
||||
private ContainerInterface $container,
|
||||
private ResourcesRoomsUpdater $updater,
|
||||
) {
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ class Manager implements IManager {
|
|||
continue;
|
||||
}
|
||||
|
||||
$this->initializedBackends[$backend] = $this->server->query($backend);
|
||||
$this->initializedBackends[$backend] = $this->container->get($backend);
|
||||
}
|
||||
|
||||
return array_values($this->initializedBackends);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use OC\Calendar\ResourcesRoomsUpdater;
|
|||
use OCP\AppFramework\QueryException;
|
||||
use OCP\Calendar\Room\IBackend;
|
||||
use OCP\Calendar\Room\IManager;
|
||||
use OCP\IServerContainer;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
class Manager implements IManager {
|
||||
private bool $bootstrapBackendsLoaded = false;
|
||||
|
|
@ -29,7 +29,7 @@ class Manager implements IManager {
|
|||
|
||||
public function __construct(
|
||||
private Coordinator $bootstrapCoordinator,
|
||||
private IServerContainer $server,
|
||||
private ContainerInterface $container,
|
||||
private ResourcesRoomsUpdater $updater,
|
||||
) {
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ class Manager implements IManager {
|
|||
* The backend might have services injected that can't be build from the
|
||||
* server container.
|
||||
*/
|
||||
$this->initializedBackends[$backend] = $this->server->query($backend);
|
||||
$this->initializedBackends[$backend] = $this->container->get($backend);
|
||||
}
|
||||
|
||||
return array_values($this->initializedBackends);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace OC\Collaboration\Resources;
|
|||
use OCP\AppFramework\QueryException;
|
||||
use OCP\Collaboration\Resources\IProvider;
|
||||
use OCP\Collaboration\Resources\IProviderManager;
|
||||
use OCP\IServerContainer;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ProviderManager implements IProviderManager {
|
||||
|
|
@ -22,7 +22,7 @@ class ProviderManager implements IProviderManager {
|
|||
protected array $providerInstances = [];
|
||||
|
||||
public function __construct(
|
||||
protected IServerContainer $serverContainer,
|
||||
protected ContainerInterface $serverContainer,
|
||||
protected LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ class ProviderManager implements IProviderManager {
|
|||
if ($this->providers !== []) {
|
||||
foreach ($this->providers as $provider) {
|
||||
try {
|
||||
$this->providerInstances[] = $this->serverContainer->query($provider);
|
||||
$this->providerInstances[] = $this->serverContainer->get($provider);
|
||||
} catch (QueryException $e) {
|
||||
$this->logger->error("Could not query resource provider $provider: " . $e->getMessage(), [
|
||||
'exception' => $e,
|
||||
|
|
|
|||
|
|
@ -11,30 +11,16 @@ namespace OC\Comments;
|
|||
|
||||
use OCP\Comments\ICommentsManager;
|
||||
use OCP\Comments\ICommentsManagerFactory;
|
||||
use OCP\IServerContainer;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
class ManagerFactory implements ICommentsManagerFactory {
|
||||
/**
|
||||
* Constructor for the comments manager factory
|
||||
*
|
||||
* @param IServerContainer $serverContainer server container
|
||||
*/
|
||||
public function __construct(
|
||||
/**
|
||||
* Server container
|
||||
*/
|
||||
private IServerContainer $serverContainer,
|
||||
private ContainerInterface $serverContainer,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* creates and returns an instance of the ICommentsManager
|
||||
*
|
||||
* @return ICommentsManager
|
||||
* @since 9.0.0
|
||||
*/
|
||||
#[\Override]
|
||||
public function getManager() {
|
||||
public function getManager(): ICommentsManager {
|
||||
return $this->serverContainer->get(Manager::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@ use OC\Contacts\ContactsMenu\Providers\ProfileProvider;
|
|||
use OCP\AppFramework\QueryException;
|
||||
use OCP\Contacts\ContactsMenu\IBulkProvider;
|
||||
use OCP\Contacts\ContactsMenu\IProvider;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\IUser;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ActionProviderStore {
|
||||
public function __construct(
|
||||
private IServerContainer $serverContainer,
|
||||
private ContainerInterface $serverContainer,
|
||||
private AppManager $appManager,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use OCP\Http\WellKnown\IRequestContext;
|
|||
use OCP\Http\WellKnown\IResponse;
|
||||
use OCP\Http\WellKnown\JrdResponse;
|
||||
use OCP\IRequest;
|
||||
use OCP\IServerContainer;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use function array_reduce;
|
||||
|
|
@ -24,7 +24,7 @@ use function array_reduce;
|
|||
class RequestManager {
|
||||
public function __construct(
|
||||
private Coordinator $coordinator,
|
||||
private IServerContainer $container,
|
||||
private ContainerInterface $container,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ declare(strict_types=1);
|
|||
*/
|
||||
namespace OC\LDAP;
|
||||
|
||||
use OCP\IServerContainer;
|
||||
use OCP\LDAP\ILDAPProviderFactory;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
class NullLDAPProviderFactory implements ILDAPProviderFactory {
|
||||
public function __construct(IServerContainer $serverContainer) {
|
||||
public function __construct(ContainerInterface $serverContainer) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ use OC\Accounts\AccountManager;
|
|||
use OC\Activity\EventMerger;
|
||||
use OC\App\AppManager;
|
||||
use OC\App\AppStore\Bundles\BundleFetcher;
|
||||
use OC\AppFramework\Bootstrap\Coordinator;
|
||||
use OC\AppFramework\Http\Request;
|
||||
use OC\AppFramework\Http\RequestId;
|
||||
use OC\AppFramework\Services\AppConfig;
|
||||
|
|
@ -102,8 +101,6 @@ use OC\OCM\OCMDiscoveryService;
|
|||
use OC\OCS\CoreCapabilities;
|
||||
use OC\OCS\DiscoveryService;
|
||||
use OC\Preview\Db\PreviewMapper;
|
||||
use OC\Preview\GeneratorHelper;
|
||||
use OC\Preview\IMagickSupport;
|
||||
use OC\Preview\MimeIconProvider;
|
||||
use OC\Preview\Watcher;
|
||||
use OC\Preview\WatcherConnector;
|
||||
|
|
@ -316,6 +313,9 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
// To find out if we are running from CLI or not
|
||||
$this->registerParameter('isCLI', \OC::$CLI);
|
||||
$this->registerParameter('serverRoot', \OC::$SERVERROOT);
|
||||
$this->registerService('userId', function (ContainerInterface $c): ?string {
|
||||
return $c->get(ISession::class)->get('user_id');
|
||||
});
|
||||
|
||||
$this->registerService(ContainerInterface::class, function (ContainerInterface $c) {
|
||||
return $c;
|
||||
|
|
@ -343,19 +343,7 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
return new View();
|
||||
}, false);
|
||||
|
||||
$this->registerService(IPreview::class, function (ContainerInterface $c) {
|
||||
return new PreviewManager(
|
||||
$c->get(IConfig::class),
|
||||
$c->get(IRootFolder::class),
|
||||
$c->get(IEventDispatcher::class),
|
||||
$c->get(GeneratorHelper::class),
|
||||
$c->get(ISession::class)->get('user_id'),
|
||||
$c->get(Coordinator::class),
|
||||
$c->get(IServerContainer::class),
|
||||
$c->get(IBinaryFinder::class),
|
||||
$c->get(IMagickSupport::class)
|
||||
);
|
||||
});
|
||||
$this->registerAlias(IPreview::class, PreviewManager::class);
|
||||
$this->registerAlias(IMimeIconProvider::class, MimeIconProvider::class);
|
||||
|
||||
$this->registerService(Watcher::class, function (ContainerInterface $c): Watcher {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ use OCP\AppFramework\QueryException;
|
|||
use OCP\Group\ISubAdmin;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\IL10N;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\IUser;
|
||||
use OCP\L10N\IFactory;
|
||||
|
|
@ -21,6 +20,7 @@ use OCP\Settings\IIconSection;
|
|||
use OCP\Settings\IManager;
|
||||
use OCP\Settings\ISettings;
|
||||
use OCP\Settings\ISubAdminSettings;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Manager implements IManager {
|
||||
|
|
@ -42,7 +42,7 @@ class Manager implements IManager {
|
|||
private LoggerInterface $log,
|
||||
private IFactory $l10nFactory,
|
||||
private IURLGenerator $url,
|
||||
private IServerContainer $container,
|
||||
private ContainerInterface $container,
|
||||
private AuthorizedGroupMapper $mapper,
|
||||
private IGroupManager $groupManager,
|
||||
private ISubAdmin $subAdmin,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ use OCP\Files\File;
|
|||
use OCP\Files\InvalidPathException;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\IConfig;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\IUserSession;
|
||||
use OCP\PreConditionNotMetException;
|
||||
use OCP\SpeechToText\ISpeechToTextManager;
|
||||
|
|
@ -28,6 +27,7 @@ use OCP\TaskProcessing\IManager as ITaskProcessingManager;
|
|||
use OCP\TaskProcessing\Task;
|
||||
use OCP\TaskProcessing\TaskTypes\AudioToText;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
|
|
@ -38,7 +38,7 @@ class SpeechToTextManager implements ISpeechToTextManager {
|
|||
private ?array $providers = null;
|
||||
|
||||
public function __construct(
|
||||
private IServerContainer $serverContainer,
|
||||
private ContainerInterface $serverContainer,
|
||||
private Coordinator $coordinator,
|
||||
private LoggerInterface $logger,
|
||||
private IJobList $jobList,
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ use OCP\EventDispatcher\IEventDispatcher;
|
|||
use OCP\IAppConfig;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\IUserSession;
|
||||
use OCP\SystemTag\ISystemTagManager;
|
||||
use OCP\SystemTag\ISystemTagManagerFactory;
|
||||
use OCP\SystemTag\ISystemTagObjectMapper;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Default factory class for system tag managers
|
||||
|
|
@ -29,7 +29,7 @@ class ManagerFactory implements ISystemTagManagerFactory {
|
|||
* Constructor for the system tag manager factory
|
||||
*/
|
||||
public function __construct(
|
||||
private IServerContainer $serverContainer,
|
||||
private ContainerInterface $serverContainer,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ declare(strict_types=1);
|
|||
namespace OC\Talk;
|
||||
|
||||
use OC\AppFramework\Bootstrap\Coordinator;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\Talk\Exceptions\NoBackendException;
|
||||
use OCP\Talk\IBroker;
|
||||
use OCP\Talk\IConversation;
|
||||
use OCP\Talk\IConversationOptions;
|
||||
use OCP\Talk\ITalkBackend;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use Throwable;
|
||||
|
|
@ -27,7 +27,7 @@ class Broker implements IBroker {
|
|||
|
||||
public function __construct(
|
||||
private Coordinator $coordinator,
|
||||
private IServerContainer $container,
|
||||
private ContainerInterface $container,
|
||||
private LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ use OCP\IAppConfig;
|
|||
use OCP\ICache;
|
||||
use OCP\ICacheFactory;
|
||||
use OCP\IL10N;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IUserSession;
|
||||
use OCP\L10N\IFactory;
|
||||
|
|
@ -98,6 +97,7 @@ use OCP\TextProcessing\IProviderWithUserId;
|
|||
use OCP\TextProcessing\SummaryTaskType;
|
||||
use OCP\TextProcessing\TopicsTaskType;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ class Manager implements IManager {
|
|||
public function __construct(
|
||||
private IAppConfig $appConfig,
|
||||
private Coordinator $coordinator,
|
||||
private IServerContainer $serverContainer,
|
||||
private ContainerInterface $serverContainer,
|
||||
private LoggerInterface $logger,
|
||||
private TaskMapper $taskMapper,
|
||||
private IJobList $jobList,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ use OCP\BackgroundJob\IJobList;
|
|||
use OCP\Common\Exception\NotFoundException;
|
||||
use OCP\DB\Exception;
|
||||
use OCP\IConfig;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\PreConditionNotMetException;
|
||||
use OCP\TaskProcessing\IManager as TaskProcessingIManager;
|
||||
use OCP\TaskProcessing\TaskTypes\TextToText;
|
||||
|
|
@ -36,6 +35,7 @@ use OCP\TextProcessing\SummaryTaskType;
|
|||
use OCP\TextProcessing\Task;
|
||||
use OCP\TextProcessing\Task as OCPTask;
|
||||
use OCP\TextProcessing\TopicsTaskType;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use Throwable;
|
||||
|
|
@ -52,7 +52,7 @@ class Manager implements IManager {
|
|||
];
|
||||
|
||||
public function __construct(
|
||||
private IServerContainer $serverContainer,
|
||||
private ContainerInterface $serverContainer,
|
||||
private Coordinator $coordinator,
|
||||
private LoggerInterface $logger,
|
||||
private IJobList $jobList,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ use OCP\Files\IAppData;
|
|||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\NotPermittedException;
|
||||
use OCP\IConfig;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\PreConditionNotMetException;
|
||||
use OCP\TextToImage\Exception\TaskFailureException;
|
||||
use OCP\TextToImage\Exception\TaskNotFoundException;
|
||||
|
|
@ -29,6 +28,7 @@ use OCP\TextToImage\IManager;
|
|||
use OCP\TextToImage\IProvider;
|
||||
use OCP\TextToImage\IProviderWithUserId;
|
||||
use OCP\TextToImage\Task;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use Throwable;
|
||||
|
|
@ -39,7 +39,7 @@ class Manager implements IManager {
|
|||
private IAppData $appData;
|
||||
|
||||
public function __construct(
|
||||
private IServerContainer $serverContainer,
|
||||
private ContainerInterface $serverContainer,
|
||||
private Coordinator $coordinator,
|
||||
private LoggerInterface $logger,
|
||||
private IJobList $jobList,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ namespace OC\Translation;
|
|||
use InvalidArgumentException;
|
||||
use OC\AppFramework\Bootstrap\Coordinator;
|
||||
use OCP\IConfig;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\IUserSession;
|
||||
use OCP\PreConditionNotMetException;
|
||||
use OCP\Translation\CouldNotTranslateException;
|
||||
|
|
@ -23,6 +22,7 @@ use OCP\Translation\ITranslationProvider;
|
|||
use OCP\Translation\ITranslationProviderWithId;
|
||||
use OCP\Translation\ITranslationProviderWithUserId;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
|
|
@ -33,7 +33,7 @@ class TranslationManager implements ITranslationManager {
|
|||
private ?array $providers = null;
|
||||
|
||||
public function __construct(
|
||||
private IServerContainer $serverContainer,
|
||||
private ContainerInterface $serverContainer,
|
||||
private Coordinator $coordinator,
|
||||
private LoggerInterface $logger,
|
||||
private IConfig $config,
|
||||
|
|
|
|||
|
|
@ -21,14 +21,14 @@ use OCP\AppFramework\QueryException;
|
|||
use OCP\Dashboard\IManager;
|
||||
use OCP\Diagnostics\IEventLogger;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\IServerContainer;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
class CoordinatorTest extends TestCase {
|
||||
private IAppManager&MockObject $appManager;
|
||||
private IServerContainer&MockObject $serverContainer;
|
||||
private ContainerInterface&MockObject $serverContainer;
|
||||
private Registry&MockObject $crashReporterRegistry;
|
||||
private IManager&MockObject $dashboardManager;
|
||||
private IEventDispatcher&MockObject $eventDispatcher;
|
||||
|
|
@ -41,7 +41,7 @@ class CoordinatorTest extends TestCase {
|
|||
parent::setUp();
|
||||
|
||||
$this->appManager = $this->createMock(IAppManager::class);
|
||||
$this->serverContainer = $this->createMock(IServerContainer::class);
|
||||
$this->serverContainer = $this->createMock(ContainerInterface::class);
|
||||
$this->crashReporterRegistry = $this->createMock(Registry::class);
|
||||
$this->dashboardManager = $this->createMock(IManager::class);
|
||||
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
|
||||
|
|
@ -67,7 +67,7 @@ class CoordinatorTest extends TestCase {
|
|||
public function testBootAppNotLoadable(): void {
|
||||
$appId = 'settings';
|
||||
$this->serverContainer->expects($this->once())
|
||||
->method('query')
|
||||
->method('get')
|
||||
->with(Application::class)
|
||||
->willThrowException(new QueryException(''));
|
||||
$this->logger->expects($this->once())
|
||||
|
|
@ -80,7 +80,7 @@ class CoordinatorTest extends TestCase {
|
|||
$appId = 'settings';
|
||||
$mockApp = $this->createMock(Application::class);
|
||||
$this->serverContainer->expects($this->once())
|
||||
->method('query')
|
||||
->method('get')
|
||||
->with(Application::class)
|
||||
->willReturn($mockApp);
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ class CoordinatorTest extends TestCase {
|
|||
}
|
||||
};
|
||||
$this->serverContainer->expects($this->once())
|
||||
->method('query')
|
||||
->method('get')
|
||||
->with(Application::class)
|
||||
->willReturn($mockApp);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,29 +15,22 @@ use OC\AppFramework\Bootstrap\ServiceRegistration;
|
|||
use OC\Calendar\Resource\Manager;
|
||||
use OC\Calendar\ResourcesRoomsUpdater;
|
||||
use OCP\Calendar\Resource\IBackend;
|
||||
use OCP\IServerContainer;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
class ManagerTest extends TestCase {
|
||||
/** @var Coordinator|MockObject */
|
||||
private $coordinator;
|
||||
|
||||
/** @var IServerContainer|MockObject */
|
||||
private $server;
|
||||
|
||||
/** @var ResourcesRoomsUpdater|MockObject */
|
||||
private $resourcesRoomsUpdater;
|
||||
|
||||
/** @var Manager */
|
||||
private $manager;
|
||||
private Coordinator&MockObject $coordinator;
|
||||
private ContainerInterface&MockObject $server;
|
||||
private ResourcesRoomsUpdater&MockObject $resourcesRoomsUpdater;
|
||||
private Manager $manager;
|
||||
|
||||
#[\Override]
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->coordinator = $this->createMock(Coordinator::class);
|
||||
$this->server = $this->createMock(IServerContainer::class);
|
||||
$this->server = $this->createMock(ContainerInterface::class);
|
||||
$this->resourcesRoomsUpdater = $this->createMock(ResourcesRoomsUpdater::class);
|
||||
|
||||
$this->manager = new Manager(
|
||||
|
|
@ -53,10 +46,10 @@ class ManagerTest extends TestCase {
|
|||
$backend2 = $this->createMock(IBackend::class);
|
||||
$backend2->method('getBackendIdentifier')->willReturn('backend_2');
|
||||
$this->server->expects(self::exactly(2))
|
||||
->method('query')
|
||||
->method('get')
|
||||
->willReturnMap([
|
||||
['calendar_resource_backend1', true, $backend1,],
|
||||
['calendar_resource_backend2', true, $backend2,],
|
||||
['calendar_resource_backend1', $backend1,],
|
||||
['calendar_resource_backend2', $backend2,],
|
||||
]);
|
||||
|
||||
$this->manager->registerBackend('calendar_resource_backend1');
|
||||
|
|
@ -85,7 +78,7 @@ class ManagerTest extends TestCase {
|
|||
new ServiceRegistration('calendar_resource_foo', $backendClass)
|
||||
]);
|
||||
$this->server->expects(self::once())
|
||||
->method('query')
|
||||
->method('get')
|
||||
->with($backendClass)
|
||||
->willReturn($backend);
|
||||
|
||||
|
|
@ -98,10 +91,10 @@ class ManagerTest extends TestCase {
|
|||
$backend2 = $this->createMock(IBackend::class);
|
||||
$backend2->method('getBackendIdentifier')->willReturn('backend_2');
|
||||
$this->server->expects(self::exactly(2))
|
||||
->method('query')
|
||||
->method('get')
|
||||
->willReturnMap([
|
||||
['calendar_resource_backend1', true, $backend1,],
|
||||
['calendar_resource_backend2', true, $backend2,],
|
||||
['calendar_resource_backend1', $backend1,],
|
||||
['calendar_resource_backend2', $backend2,],
|
||||
]);
|
||||
|
||||
$this->manager->registerBackend('calendar_resource_backend1');
|
||||
|
|
@ -117,10 +110,10 @@ class ManagerTest extends TestCase {
|
|||
$backend2 = $this->createMock(IBackend::class);
|
||||
$backend2->method('getBackendIdentifier')->willReturn('backend_2');
|
||||
$this->server->expects(self::exactly(2))
|
||||
->method('query')
|
||||
->method('get')
|
||||
->willReturnMap([
|
||||
['calendar_resource_backend1', true, $backend1,],
|
||||
['calendar_resource_backend2', true, $backend2,],
|
||||
['calendar_resource_backend1', $backend1,],
|
||||
['calendar_resource_backend2', $backend2,],
|
||||
]);
|
||||
|
||||
$this->manager->registerBackend('calendar_resource_backend1');
|
||||
|
|
|
|||
|
|
@ -15,15 +15,15 @@ use OC\AppFramework\Bootstrap\ServiceRegistration;
|
|||
use OC\Calendar\ResourcesRoomsUpdater;
|
||||
use OC\Calendar\Room\Manager;
|
||||
use OCP\Calendar\Room\IBackend;
|
||||
use OCP\IServerContainer;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
class ManagerTest extends TestCase {
|
||||
/** @var Coordinator|MockObject */
|
||||
private $coordinator;
|
||||
|
||||
/** @var IServerContainer|MockObject */
|
||||
/** @var ContainerInterface|MockObject */
|
||||
private $server;
|
||||
|
||||
/** @var ResourcesRoomsUpdater|MockObject */
|
||||
|
|
@ -37,7 +37,7 @@ class ManagerTest extends TestCase {
|
|||
parent::setUp();
|
||||
|
||||
$this->coordinator = $this->createMock(Coordinator::class);
|
||||
$this->server = $this->createMock(IServerContainer::class);
|
||||
$this->server = $this->createMock(ContainerInterface::class);
|
||||
$this->resourcesRoomsUpdater = $this->createMock(ResourcesRoomsUpdater::class);
|
||||
|
||||
$this->manager = new Manager(
|
||||
|
|
@ -53,10 +53,10 @@ class ManagerTest extends TestCase {
|
|||
$backend2 = $this->createMock(IBackend::class);
|
||||
$backend2->method('getBackendIdentifier')->willReturn('backend_2');
|
||||
$this->server->expects(self::exactly(2))
|
||||
->method('query')
|
||||
->method('get')
|
||||
->willReturnMap([
|
||||
['calendar_room_backend1', true, $backend1,],
|
||||
['calendar_room_backend2', true, $backend2,],
|
||||
['calendar_room_backend1', $backend1,],
|
||||
['calendar_room_backend2', $backend2,],
|
||||
]);
|
||||
|
||||
$this->manager->registerBackend('calendar_room_backend1');
|
||||
|
|
@ -87,7 +87,7 @@ class ManagerTest extends TestCase {
|
|||
new ServiceRegistration('calendar_room_foo', $backendClass)
|
||||
]);
|
||||
$this->server->expects(self::once())
|
||||
->method('query')
|
||||
->method('get')
|
||||
->with($backendClass)
|
||||
->willReturn($backend);
|
||||
|
||||
|
|
@ -100,10 +100,10 @@ class ManagerTest extends TestCase {
|
|||
$backend2 = $this->createMock(IBackend::class);
|
||||
$backend2->method('getBackendIdentifier')->willReturn('backend_2');
|
||||
$this->server->expects(self::exactly(2))
|
||||
->method('query')
|
||||
->method('get')
|
||||
->willReturnMap([
|
||||
['calendar_room_backend1', true, $backend1,],
|
||||
['calendar_room_backend2', true, $backend2,],
|
||||
['calendar_room_backend1', $backend1,],
|
||||
['calendar_room_backend2', $backend2,],
|
||||
]);
|
||||
|
||||
$this->manager->registerBackend('calendar_room_backend1');
|
||||
|
|
@ -119,10 +119,10 @@ class ManagerTest extends TestCase {
|
|||
$backend2 = $this->createMock(IBackend::class);
|
||||
$backend2->method('getBackendIdentifier')->willReturn('backend_2');
|
||||
$this->server->expects(self::exactly(2))
|
||||
->method('query')
|
||||
->method('get')
|
||||
->willReturnMap([
|
||||
['calendar_room_backend1', true, $backend1,],
|
||||
['calendar_room_backend2', true, $backend2,],
|
||||
['calendar_room_backend1', $backend1,],
|
||||
['calendar_room_backend2', $backend2,],
|
||||
]);
|
||||
|
||||
$this->manager->registerBackend('calendar_room_backend1');
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@ use OC\Collaboration\Resources\ProviderManager;
|
|||
use OCA\Files\Collaboration\Resources\ResourceProvider;
|
||||
use OCP\AppFramework\QueryException;
|
||||
use OCP\Collaboration\Resources\IProviderManager;
|
||||
use OCP\IServerContainer;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
class ProviderManagerTest extends TestCase {
|
||||
/** @var IServerContainer */
|
||||
/** @var ContainerInterface */
|
||||
protected $serverContainer;
|
||||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
|
|
@ -28,7 +28,7 @@ class ProviderManagerTest extends TestCase {
|
|||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->serverContainer = $this->createMock(IServerContainer::class);
|
||||
$this->serverContainer = $this->createMock(ContainerInterface::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
|
||||
$this->providerManager = new class($this->serverContainer, $this->logger) extends ProviderManager {
|
||||
|
|
@ -49,7 +49,7 @@ class ProviderManagerTest extends TestCase {
|
|||
|
||||
public function testGetResourceProvidersValidProvider(): void {
|
||||
$this->serverContainer->expects($this->once())
|
||||
->method('query')
|
||||
->method('get')
|
||||
->with($this->equalTo(ResourceProvider::class))
|
||||
->willReturn($this->createMock(ResourceProvider::class));
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ class ProviderManagerTest extends TestCase {
|
|||
|
||||
public function testGetResourceProvidersInvalidProvider(): void {
|
||||
$this->serverContainer->expects($this->once())
|
||||
->method('query')
|
||||
->method('get')
|
||||
->with($this->equalTo('InvalidResourceProvider'))
|
||||
->willThrowException(new QueryException('A meaningful error message'));
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ class ProviderManagerTest extends TestCase {
|
|||
|
||||
public function testGetResourceProvidersValidAndInvalidProvider(): void {
|
||||
$this->serverContainer->expects($this->exactly(2))
|
||||
->method('query')
|
||||
->method('get')
|
||||
->willReturnCallback(function (string $service) {
|
||||
if ($service === 'InvalidResourceProvider') {
|
||||
throw new QueryException('A meaningful error message');
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@
|
|||
namespace Test\Comments;
|
||||
|
||||
use OCP\Comments\ICommentsManagerFactory;
|
||||
use OCP\IServerContainer;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Class FakeFactory
|
||||
*/
|
||||
class FakeFactory implements ICommentsManagerFactory {
|
||||
public function __construct(IServerContainer $serverContainer) {
|
||||
public function __construct(ContainerInterface $serverContainer) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
|
|
|
|||
|
|
@ -15,26 +15,22 @@ use OC\Contacts\ContactsMenu\Providers\ProfileProvider;
|
|||
use OCP\App\IAppManager;
|
||||
use OCP\AppFramework\QueryException;
|
||||
use OCP\Contacts\ContactsMenu\IProvider;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\IUser;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
class ActionProviderStoreTest extends TestCase {
|
||||
/** @var IServerContainer|MockObject */
|
||||
private $serverContainer;
|
||||
|
||||
/** @var IAppManager|MockObject */
|
||||
private $appManager;
|
||||
|
||||
private ContainerInterface&MockObject $serverContainer;
|
||||
private IAppManager&MockObject $appManager;
|
||||
private ActionProviderStore $actionProviderStore;
|
||||
|
||||
#[\Override]
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->serverContainer = $this->createMock(IServerContainer::class);
|
||||
$this->serverContainer = $this->createMock(ContainerInterface::class);
|
||||
$this->appManager = $this->createMock(AppManager::class);
|
||||
$logger = $this->createMock(LoggerInterface::class);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,32 +19,25 @@ use OCP\Http\WellKnown\IRequestContext;
|
|||
use OCP\Http\WellKnown\IResponse;
|
||||
use OCP\Http\WellKnown\JrdResponse;
|
||||
use OCP\IRequest;
|
||||
use OCP\IServerContainer;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use Test\TestCase;
|
||||
use function get_class;
|
||||
|
||||
class RequestManagerTest extends TestCase {
|
||||
/** @var Coordinator|MockObject */
|
||||
private $coordinator;
|
||||
|
||||
/** @var IServerContainer|MockObject */
|
||||
private $container;
|
||||
|
||||
/** @var MockObject|LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
/** @var RequestManager */
|
||||
private $manager;
|
||||
private Coordinator&MockObject $coordinator;
|
||||
private ContainerInterface&MockObject $container;
|
||||
private LoggerInterface&MockObject $logger;
|
||||
private RequestManager $manager;
|
||||
|
||||
#[\Override]
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->coordinator = $this->createMock(Coordinator::class);
|
||||
$this->container = $this->createMock(IServerContainer::class);
|
||||
$this->container = $this->createMock(ContainerInterface::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
|
||||
$this->manager = new RequestManager(
|
||||
|
|
|
|||
|
|
@ -12,17 +12,15 @@ namespace Test;
|
|||
use JsonSerializable;
|
||||
use OC\AppFramework\Bootstrap\Coordinator;
|
||||
use OC\InitialStateService;
|
||||
use OCP\IServerContainer;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use stdClass;
|
||||
use function json_encode;
|
||||
|
||||
class InitialStateServiceTest extends TestCase {
|
||||
/** @var InitialStateService */
|
||||
private $service;
|
||||
/** @var MockObject|LoggerInterface|(LoggerInterface&MockObject) */
|
||||
protected $logger;
|
||||
private InitialStateService $service;
|
||||
protected LoggerInterface&MockObject $logger;
|
||||
|
||||
#[\Override]
|
||||
protected function setUp(): void {
|
||||
|
|
@ -33,7 +31,7 @@ class InitialStateServiceTest extends TestCase {
|
|||
$this->service = new InitialStateService(
|
||||
$this->logger,
|
||||
$this->createMock(Coordinator::class),
|
||||
$this->createMock(IServerContainer::class)
|
||||
$this->createMock(ContainerInterface::class)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,38 +11,29 @@ use OC\Settings\AuthorizedGroupMapper;
|
|||
use OC\Settings\Manager;
|
||||
use OCA\WorkflowEngine\Settings\Section;
|
||||
use OCP\Group\ISubAdmin;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\IL10N;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\L10N\IFactory;
|
||||
use OCP\Server;
|
||||
use OCP\Settings\ISettings;
|
||||
use OCP\Settings\ISubAdminSettings;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
class ManagerTest extends TestCase {
|
||||
/** @var Manager|MockObject */
|
||||
private $manager;
|
||||
/** @var LoggerInterface|MockObject */
|
||||
private $logger;
|
||||
/** @var IDBConnection|MockObject */
|
||||
private $l10n;
|
||||
/** @var IFactory|MockObject */
|
||||
private $l10nFactory;
|
||||
/** @var IURLGenerator|MockObject */
|
||||
private $url;
|
||||
/** @var IServerContainer|MockObject */
|
||||
private $container;
|
||||
/** @var AuthorizedGroupMapper|MockObject */
|
||||
private $mapper;
|
||||
/** @var IGroupManager|MockObject */
|
||||
private $groupManager;
|
||||
/** @var ISubAdmin|MockObject */
|
||||
private $subAdmin;
|
||||
private LoggerInterface&MockObject $logger;
|
||||
private IL10N&MockObject $l10n;
|
||||
private IFactory&MockObject $l10nFactory;
|
||||
private IURLGenerator&MockObject $url;
|
||||
private ContainerInterface&MockObject $container;
|
||||
private AuthorizedGroupMapper&MockObject $mapper;
|
||||
private IGroupManager&MockObject $groupManager;
|
||||
private ISubAdmin&MockObject $subAdmin;
|
||||
|
||||
private Manager $manager;
|
||||
|
||||
#[\Override]
|
||||
protected function setUp(): void {
|
||||
|
|
@ -52,7 +43,7 @@ class ManagerTest extends TestCase {
|
|||
$this->l10n = $this->createMock(IL10N::class);
|
||||
$this->l10nFactory = $this->createMock(IFactory::class);
|
||||
$this->url = $this->createMock(IURLGenerator::class);
|
||||
$this->container = $this->createMock(IServerContainer::class);
|
||||
$this->container = $this->createMock(ContainerInterface::class);
|
||||
$this->mapper = $this->createMock(AuthorizedGroupMapper::class);
|
||||
$this->groupManager = $this->createMock(IGroupManager::class);
|
||||
$this->subAdmin = $this->createMock(ISubAdmin::class);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ use OCP\Constants;
|
|||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\Files\Cache\ICacheEntry;
|
||||
use OCP\Files\File;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\Server;
|
||||
use OCP\Share\Events\BeforeShareCreatedEvent;
|
||||
use OCP\Share\Events\BeforeShareDeletedEvent;
|
||||
|
|
@ -24,6 +23,7 @@ use OCP\Share\IManager as IShareManager;
|
|||
use OCP\Share\IShare;
|
||||
use OCP\Util;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ class LegacyHooksTest extends TestCase {
|
|||
|
||||
$symfonyDispatcher = new \Symfony\Component\EventDispatcher\EventDispatcher();
|
||||
$logger = $this->createMock(LoggerInterface::class);
|
||||
$this->eventDispatcher = new EventDispatcher($symfonyDispatcher, Server::get(IServerContainer::class), $logger);
|
||||
$this->eventDispatcher = new EventDispatcher($symfonyDispatcher, Server::get(ContainerInterface::class), $logger);
|
||||
$this->hooks = new LegacyHooks($this->eventDispatcher);
|
||||
$this->manager = Server::get(IShareManager::class);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ use OCP\IDBConnection;
|
|||
use OCP\IGroup;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\IL10N;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IUserSession;
|
||||
|
|
@ -66,6 +65,7 @@ use PHPUnit\Framework\Attributes\DataProvider;
|
|||
use PHPUnit\Framework\Attributes\Group;
|
||||
use PHPUnit\Framework\MockObject\MockBuilder;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class DummyShareManagerListener {
|
||||
|
|
@ -4775,7 +4775,7 @@ class ManagerTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testGetSharesInFolder(): void {
|
||||
$factory = new DummyFactory2($this->createMock(IServerContainer::class));
|
||||
$factory = new DummyFactory2($this->createMock(ContainerInterface::class));
|
||||
|
||||
$manager = $this->createManager($factory);
|
||||
|
||||
|
|
@ -4822,7 +4822,7 @@ class ManagerTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testGetSharesInFolderOwnerless(): void {
|
||||
$factory = new DummyFactory2($this->createMock(IServerContainer::class));
|
||||
$factory = new DummyFactory2($this->createMock(ContainerInterface::class));
|
||||
|
||||
$manager = $this->createManager($factory);
|
||||
|
||||
|
|
@ -4857,7 +4857,7 @@ class ManagerTest extends \Test\TestCase {
|
|||
|
||||
|
||||
public function testGetAccessList(): void {
|
||||
$factory = new DummyFactory2($this->createMock(IServerContainer::class));
|
||||
$factory = new DummyFactory2($this->createMock(ContainerInterface::class));
|
||||
|
||||
$manager = $this->createManager($factory);
|
||||
|
||||
|
|
@ -4956,7 +4956,7 @@ class ManagerTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testGetAccessListWithCurrentAccess(): void {
|
||||
$factory = new DummyFactory2($this->createMock(IServerContainer::class));
|
||||
$factory = new DummyFactory2($this->createMock(ContainerInterface::class));
|
||||
|
||||
$manager = $this->createManager($factory);
|
||||
|
||||
|
|
@ -5064,7 +5064,7 @@ class ManagerTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testGetAllShares(): void {
|
||||
$factory = new DummyFactory2($this->createMock(IServerContainer::class));
|
||||
$factory = new DummyFactory2($this->createMock(ContainerInterface::class));
|
||||
|
||||
$manager = $this->createManager($factory);
|
||||
|
||||
|
|
@ -5180,7 +5180,7 @@ class DummyFactory implements IProviderFactory {
|
|||
/** @var IShareProvider */
|
||||
protected $provider;
|
||||
|
||||
public function __construct(IServerContainer $serverContainer) {
|
||||
public function __construct(ContainerInterface $serverContainer) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ use OC\AppFramework\Bootstrap\RegistrationContext;
|
|||
use OC\AppFramework\Bootstrap\ServiceRegistration;
|
||||
use OC\Talk\Broker;
|
||||
use OCP\AppFramework\QueryException;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\Talk\IConversationOptions;
|
||||
use OCP\Talk\ITalkBackend;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use Test\TestCase;
|
||||
|
|
@ -25,7 +25,7 @@ use Test\TestCase;
|
|||
class BrokerTest extends TestCase {
|
||||
private Coordinator $coordinator;
|
||||
|
||||
private IServerContainer $container;
|
||||
private ContainerInterface $container;
|
||||
|
||||
private LoggerInterface $logger;
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ class BrokerTest extends TestCase {
|
|||
parent::setUp();
|
||||
|
||||
$this->coordinator = $this->createMock(Coordinator::class);
|
||||
$this->container = $this->createMock(IServerContainer::class);
|
||||
$this->container = $this->createMock(ContainerInterface::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
|
||||
$this->broker = new Broker(
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ use OCP\IAppConfig;
|
|||
use OCP\ICacheFactory;
|
||||
use OCP\IConfig;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IUserSession;
|
||||
|
|
@ -56,6 +55,7 @@ use OCP\TaskProcessing\TaskTypes\TextToTextSummary;
|
|||
use OCP\TextProcessing\SummaryTaskType;
|
||||
use PHPUnit\Framework\Constraint\IsInstanceOf;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\BackgroundJob\DummyJobList;
|
||||
|
||||
|
|
@ -765,7 +765,7 @@ class ConflictingExternalTaskType implements ITaskType {
|
|||
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
||||
class TaskProcessingTest extends \Test\TestCase {
|
||||
private Coordinator&MockObject $coordinator;
|
||||
private IServerContainer&MockObject $serverContainer;
|
||||
private ContainerInterface&MockObject $serverContainer;
|
||||
private IEventDispatcher&MockObject $eventDispatcher;
|
||||
private IJobList&MockObject $jobList;
|
||||
private IUserMountCache&MockObject $userMountCache;
|
||||
|
|
@ -808,7 +808,7 @@ class TaskProcessingTest extends \Test\TestCase {
|
|||
$userManager->createUser(self::TEST_USER, 'test');
|
||||
}
|
||||
|
||||
$this->serverContainer = $this->createMock(IServerContainer::class);
|
||||
$this->serverContainer = $this->createMock(ContainerInterface::class);
|
||||
$this->serverContainer->expects($this->any())->method('get')->willReturnCallback(function ($class) {
|
||||
return $this->providers[$class];
|
||||
});
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ use OCP\BackgroundJob\IJobList;
|
|||
use OCP\Common\Exception\NotFoundException;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\IConfig;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\PreConditionNotMetException;
|
||||
use OCP\Server;
|
||||
use OCP\TextProcessing\Events\TaskFailedEvent;
|
||||
|
|
@ -34,6 +33,7 @@ use OCP\TextProcessing\SummaryTaskType;
|
|||
use OCP\TextProcessing\Task;
|
||||
use OCP\TextProcessing\TopicsTaskType;
|
||||
use PHPUnit\Framework\Constraint\IsInstanceOf;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\BackgroundJob\DummyJobList;
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ class TextProcessingTest extends \Test\TestCase {
|
|||
private IManager $manager;
|
||||
private Coordinator $coordinator;
|
||||
private array $providers;
|
||||
private IServerContainer $serverContainer;
|
||||
private ContainerInterface $serverContainer;
|
||||
private IEventDispatcher $eventDispatcher;
|
||||
private RegistrationContext $registrationContext;
|
||||
private \DateTimeImmutable $currentTime;
|
||||
|
|
@ -120,7 +120,7 @@ class TextProcessingTest extends \Test\TestCase {
|
|||
FreePromptProvider::class => new FreePromptProvider(),
|
||||
];
|
||||
|
||||
$this->serverContainer = $this->createMock(IServerContainer::class);
|
||||
$this->serverContainer = $this->createMock(ContainerInterface::class);
|
||||
$this->serverContainer->expects($this->any())->method('get')->willReturnCallback(function ($class) {
|
||||
return $this->providers[$class];
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue