From 6f1fe2de3177c49c4c80244ce2a69f454e447722 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 26 Feb 2024 17:57:45 +0100 Subject: [PATCH] fix tests Signed-off-by: Robin Appelman --- tests/ACL/ACLCacheWrapperTest.php | 7 +++---- tests/Folder/FolderManagerTest.php | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/ACL/ACLCacheWrapperTest.php b/tests/ACL/ACLCacheWrapperTest.php index 5270af4f9..b532dfbe6 100644 --- a/tests/ACL/ACLCacheWrapperTest.php +++ b/tests/ACL/ACLCacheWrapperTest.php @@ -31,6 +31,9 @@ use OCP\IDBConnection; use Test\TestCase; +/** + * @group DB + */ class ACLCacheWrapperTest extends TestCase { /** @var ACLManager|\PHPUnit_Framework_MockObject_MockObject */ private $aclManager; @@ -43,10 +46,6 @@ class ACLCacheWrapperTest extends TestCase { protected function setUp(): void { parent::setUp(); - \OC::$server->registerService(IDBConnection::class, function () { - return $this->createMock(IDBConnection::class); - }); - $this->aclManager = $this->createMock(ACLManager::class); $this->aclManager->method('getACLPermissionsForPath') ->willReturnCallback(function (string $path) { diff --git a/tests/Folder/FolderManagerTest.php b/tests/Folder/FolderManagerTest.php index 4393b7a8e..5615611bc 100644 --- a/tests/Folder/FolderManagerTest.php +++ b/tests/Folder/FolderManagerTest.php @@ -298,10 +298,13 @@ public function testGetFoldersForGroups() { * @return \PHPUnit_Framework_MockObject_MockObject|IUser */ protected function getUser($groups = []) { + $id = uniqid(); $user = $this->createMock(IUser::class); $this->groupManager->expects($this->any()) ->method('getUserGroupIds') ->willReturn($groups); + $user->method('getUID') + ->willReturn($id); return $user; }