From 3308e132b59db8a67c285c08e06276043e93204e Mon Sep 17 00:00:00 2001 From: Nalem7 <61624650+nabim777@users.noreply.github.com> Date: Wed, 5 Aug 2026 10:14:49 +0545 Subject: [PATCH] test: adapt DirectDownloadServiceTest for DirectController dependency changes (#1133) * test: add IManager dependency to DirectDownloadServiceTest Signed-off-by: nabim777 * test: adapt DirectDownloadServiceTest for DirectController dependency changes Signed-off-by: nabim777 --------- Signed-off-by: nabim777 --- .../lib/Service/DirectDownloadServiceTest.php | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/tests/lib/Service/DirectDownloadServiceTest.php b/tests/lib/Service/DirectDownloadServiceTest.php index e905f3c59..d2a475d80 100644 --- a/tests/lib/Service/DirectDownloadServiceTest.php +++ b/tests/lib/Service/DirectDownloadServiceTest.php @@ -8,16 +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\Files\IRootFolder; -use OCP\IRequest; -use OCP\IURLGenerator; use OCP\IUserManager; -use OCP\Security\ISecureRandom; use PHPUnit\Framework\TestCase; class DirectDownloadServiceTest extends TestCase { @@ -54,31 +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) - ); + + $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(); }