diff --git a/apps/encryption/tests/Crypto/EncryptAllTest.php b/apps/encryption/tests/Crypto/EncryptAllTest.php index b99e9144be8..459f680a374 100644 --- a/apps/encryption/tests/Crypto/EncryptAllTest.php +++ b/apps/encryption/tests/Crypto/EncryptAllTest.php @@ -121,6 +121,7 @@ class EncryptAllTest extends TestCase { /* We need format method to return a string */ $outputFormatter = $this->createMock(OutputFormatterInterface::class); + $outputFormatter->method('isDecorated')->willReturn(false); $outputFormatter->method('format')->willReturnArgument(0); $this->outputInterface->expects($this->any())->method('getFormatter') @@ -346,9 +347,11 @@ class EncryptAllTest extends TestCase { ['/user1/files/foo/subfile'], ); + $outputFormatter = $this->createMock(OutputFormatterInterface::class); + $outputFormatter->method('isDecorated')->willReturn(false); $this->outputInterface->expects($this->any()) ->method('getFormatter') - ->willReturn($this->createMock(OutputFormatterInterface::class)); + ->willReturn($outputFormatter); $progressBar = new ProgressBar($this->outputInterface); $this->invokePrivate($encryptAll, 'encryptUsersFiles', ['user1', $progressBar, '']); diff --git a/lib/private/Console/TimestampFormatter.php b/lib/private/Console/TimestampFormatter.php index c25ed578805..8d74c28e94f 100644 --- a/lib/private/Console/TimestampFormatter.php +++ b/lib/private/Console/TimestampFormatter.php @@ -94,11 +94,11 @@ class TimestampFormatter implements OutputFormatterInterface { /** * Formats a message according to the given styles. * - * @param string $message The message to style - * @return string The styled message, prepended with a timestamp using the + * @param string|null $message The message to style + * @return string|null The styled message, prepended with a timestamp using the * log timezone and dateformat, e.g. "2015-06-23T17:24:37+02:00" */ - public function format($message) { + public function format(?string $message): ?string { if (!$this->formatter->isDecorated()) { // Don't add anything to the output when we shouldn't return $this->formatter->format($message); diff --git a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php index 1d5e2ac420d..ecb3faaa25d 100644 --- a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php +++ b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php @@ -75,6 +75,7 @@ class ChangeKeyStorageRootTest extends TestCase { /* We need format method to return a string */ $outputFormatter = $this->createMock(OutputFormatterInterface::class); + $outputFormatter->method('isDecorated')->willReturn(false); $outputFormatter->method('format')->willReturnArgument(0); $this->outputInterface->expects($this->any())->method('getFormatter') diff --git a/tests/Core/Command/Preview/RepairTest.php b/tests/Core/Command/Preview/RepairTest.php index d235c0d0aea..090e9cc0bd0 100644 --- a/tests/Core/Command/Preview/RepairTest.php +++ b/tests/Core/Command/Preview/RepairTest.php @@ -71,6 +71,7 @@ class RepairTest extends TestCase { /* We need format method to return a string */ $outputFormatter = $this->createMock(OutputFormatterInterface::class); + $outputFormatter->method('isDecorated')->willReturn(false); $outputFormatter->method('format')->willReturnArgument(0); $this->output->expects($this->any()) diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php index f33f88eb214..69f78f435cf 100644 --- a/tests/lib/Encryption/DecryptAllTest.php +++ b/tests/lib/Encryption/DecryptAllTest.php @@ -77,12 +77,15 @@ class DecryptAllTest extends TestCase { ->disableOriginalConstructor()->getMock(); $this->outputInterface = $this->getMockBuilder(OutputInterface::class) ->disableOriginalConstructor()->getMock(); + $this->outputInterface->expects($this->any())->method('isDecorated') + ->willReturn(false); $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'); + $outputFormatter->method('isDecorated')->willReturn(false); $this->outputInterface->expects($this->any())->method('getFormatter') ->willReturn($outputFormatter); @@ -304,6 +307,7 @@ class DecryptAllTest extends TestCase { /* We need format method to return a string */ $outputFormatter = $this->createMock(OutputFormatterInterface::class); + $outputFormatter->method('isDecorated')->willReturn(false); $outputFormatter->method('format')->willReturn('foo'); $output = $this->createMock(OutputInterface::class);