From a50fc7e33be2ac5b640d15a96a2f10894c893229 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Thu, 10 Sep 2026 23:39:00 +0200 Subject: [PATCH] fix(tests): mock IUserFolder where getUserFolder is stubbed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IRootFolder::getUserFolder() returns OCP\Files\IUserFolder since server 36, so a Folder mock no longer satisfies its declared return type and PHPUnit refuses it: Method getUserFolder may not return value of type Mock_Folder_…, its declared return type is "OCP\Files\IUserFolder" That fails the phpunit jobs of every pull request touching lib/, tests/ or appinfo/, since those are what the path filter runs them for. IUserFolder extends Folder, so the mock still answers everything the code under test calls. Assisted-by: Claude Code:claude-opus-5 Claude-Session: https://claude.ai/code/session_01LpP9ULLNJTV7EoQSeLUEPB Signed-off-by: Andy Scherzinger --- tests/unit/Service/FilesAppServiceTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/Service/FilesAppServiceTest.php b/tests/unit/Service/FilesAppServiceTest.php index c3054e2b5f..765c737c3c 100644 --- a/tests/unit/Service/FilesAppServiceTest.php +++ b/tests/unit/Service/FilesAppServiceTest.php @@ -98,7 +98,7 @@ public function testCreateWithValidFilename() { ->method('validateFilename') ->with('valid-file.txt'); - $userFolder = $this->createMock(\OCP\Files\Folder::class); + $userFolder = $this->createMock(\OCP\Files\IUserFolder::class); $this->rootFolder->expects($this->any()) ->method('getUserFolder') ->willReturn($userFolder);