From 065531570d8466d305c51bcfc2b09713057f10a7 Mon Sep 17 00:00:00 2001 From: Côme Chilliet Date: Mon, 25 Oct 2021 12:33:56 +0200 Subject: Fix Encryption tests on PHP 8.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- tests/lib/Encryption/DecryptAllTest.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tests/lib/Encryption') diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php index dc7c40f0fe2..90ff045a9b9 100644 --- a/tests/lib/Encryption/DecryptAllTest.php +++ b/tests/lib/Encryption/DecryptAllTest.php @@ -81,8 +81,12 @@ class DecryptAllTest extends TestCase { $this->userInterface = $this->getMockBuilder(UserInterface::class) ->disableOriginalConstructor()->getMock(); + /* We need format method to return a string */ + $outputFormatter = $this->createMock(OutputFormatterInterface::class); + $outputFormatter->method('format')->willReturn('foo'); + $this->outputInterface->expects($this->any())->method('getFormatter') - ->willReturn($this->createMock(OutputFormatterInterface::class)); + ->willReturn($outputFormatter); $this->instance = new DecryptAll($this->encryptionManager, $this->userManager, $this->view); @@ -298,10 +302,15 @@ class DecryptAllTest extends TestCase { ->method('decryptFile') ->with('/user1/files/foo/subfile'); + + /* We need format method to return a string */ + $outputFormatter = $this->createMock(OutputFormatterInterface::class); + $outputFormatter->method('format')->willReturn('foo'); + $output = $this->createMock(OutputInterface::class); $output->expects($this->any()) ->method('getFormatter') - ->willReturn($this->createMock(OutputFormatterInterface::class)); + ->willReturn($outputFormatter); $progressBar = new ProgressBar($output); $this->invokePrivate($instance, 'decryptUsersFiles', ['user1', $progressBar, '']); -- cgit v1.2.3