From e1381311d1bc53270a3829917979862fc550e1b0 Mon Sep 17 00:00:00 2001 From: nabim777 Date: Tue, 4 Aug 2026 10:00:37 +0545 Subject: [PATCH 1/2] test: add IManager dependency to DirectDownloadServiceTest Signed-off-by: nabim777 --- tests/lib/Service/DirectDownloadServiceTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/lib/Service/DirectDownloadServiceTest.php b/tests/lib/Service/DirectDownloadServiceTest.php index e905f3c59..cee9a43e2 100644 --- a/tests/lib/Service/DirectDownloadServiceTest.php +++ b/tests/lib/Service/DirectDownloadServiceTest.php @@ -13,6 +13,7 @@ use OCA\OpenProject\AppInfo\Application; use OCP\AppFramework\Utility\ITimeFactory; use OCP\EventDispatcher\IEventDispatcher; +use OCP\Share\IManager; use OCP\Files\IRootFolder; use OCP\IRequest; use OCP\IURLGenerator; @@ -70,7 +71,8 @@ protected function setUp(): void { $c->get(ISecureRandom::class), $c->get(ITimeFactory::class), $c->get(IURLGenerator::class), - $c->get(IEventDispatcher::class) + $c->get(IEventDispatcher::class), + $c->get(IManager::class) ); } From 650a005514173d7f97ca420728ad34b848206d2d Mon Sep 17 00:00:00 2001 From: nabim777 Date: Wed, 5 Aug 2026 09:30:06 +0545 Subject: [PATCH 2/2] test: adapt DirectDownloadServiceTest for DirectController dependency changes Signed-off-by: nabim777 --- .../lib/Service/DirectDownloadServiceTest.php | 31 ++++++------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/tests/lib/Service/DirectDownloadServiceTest.php b/tests/lib/Service/DirectDownloadServiceTest.php index cee9a43e2..d2a475d80 100644 --- a/tests/lib/Service/DirectDownloadServiceTest.php +++ b/tests/lib/Service/DirectDownloadServiceTest.php @@ -8,17 +8,11 @@ namespace OCA\OpenProject\Service; +use OC\User\Session; use OCA\DAV\Controller\DirectController; -use OCA\DAV\Db\DirectMapper; use OCA\OpenProject\AppInfo\Application; -use OCP\AppFramework\Utility\ITimeFactory; -use OCP\EventDispatcher\IEventDispatcher; -use OCP\Share\IManager; use OCP\Files\IRootFolder; -use OCP\IRequest; -use OCP\IURLGenerator; use OCP\IUserManager; -use OCP\Security\ISecureRandom; use PHPUnit\Framework\TestCase; class DirectDownloadServiceTest extends TestCase { @@ -55,32 +49,27 @@ protected function setUp(): void { $app = new Application(); $c = $app->getContainer(); - /** @var DirectDownloadService directDownloadService */ + $userManager = $c->get(IUserManager::class); + $user = $userManager->get(self::USER_ID); + $userSession = $c->get(Session::class); + $userSession->setUser($user); + + /** @var DirectDownloadService $directDownloadService */ $directDownloadService = $c->get(DirectDownloadService::class); $this->directDownloadService = $directDownloadService; /** @var IRootFolder $root */ $root = $c->get(IRootFolder::class); $this->userFolder = $root->getUserFolder(self::USER_ID); - $this->directController = new DirectController( - 'dav', - $c->get(IRequest::class), - $root, - self::USER_ID, - $c->get(DirectMapper::class), - $c->get(ISecureRandom::class), - $c->get(ITimeFactory::class), - $c->get(IURLGenerator::class), - $c->get(IEventDispatcher::class), - $c->get(IManager::class) - ); + + $this->directController = $c->get(DirectController::class); } public static function tearDownAfterClass(): void { $app = new Application(); $c = $app->getContainer(); $userManager = $c->get(IUserManager::class); - $user = $userManager->get('test'); + $user = $userManager->get(self::USER_ID); $user->delete(); }