diff options
Diffstat (limited to 'tests/Core/Command/Preview')
-rw-r--r-- | tests/Core/Command/Preview/CleanupTest.php | 5 | ||||
-rw-r--r-- | tests/Core/Command/Preview/RepairTest.php | 20 |
2 files changed, 10 insertions, 15 deletions
diff --git a/tests/Core/Command/Preview/CleanupTest.php b/tests/Core/Command/Preview/CleanupTest.php index fcbb7582ca3..e4a83246e5b 100644 --- a/tests/Core/Command/Preview/CleanupTest.php +++ b/tests/Core/Command/Preview/CleanupTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -99,9 +100,7 @@ class CleanupTest extends TestCase { $this->assertEquals(1, $this->repair->run($this->input, $this->output)); } - /** - * @dataProvider dataForTestCleanupWithDeleteException - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataForTestCleanupWithDeleteException')] public function testCleanupWithDeleteException(string $exceptionClass, string $errorMessage): void { $previewFolder = $this->createMock(Folder::class); $previewFolder->expects($this->once()) diff --git a/tests/Core/Command/Preview/RepairTest.php b/tests/Core/Command/Preview/RepairTest.php index e54f4dde3ad..9b9cde6dd95 100644 --- a/tests/Core/Command/Preview/RepairTest.php +++ b/tests/Core/Command/Preview/RepairTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -16,6 +17,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use Symfony\Component\Console\Formatter\OutputFormatterInterface; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Console\Output\OutputInterface; use Test\TestCase; @@ -54,8 +56,7 @@ class RepairTest extends TestCase { $this->iniGetWrapper, $this->createMock(ILockingProvider::class) ); - $this->input = $this->getMockBuilder(InputInterface::class) - ->getMock(); + $this->input = $this->createMock(InputInterface::class); $this->input->expects($this->any()) ->method('getOption') ->willReturnCallback(function ($parameter) { @@ -64,13 +65,10 @@ class RepairTest extends TestCase { } return null; }); - $this->output = $this->getMockBuilder(OutputInterface::class) - ->setMethods(['section', 'writeln', 'write', 'setVerbosity', 'getVerbosity', 'isQuiet', 'isVerbose', 'isVeryVerbose', 'isDebug', 'setDecorated', 'isDecorated', 'setFormatter', 'getFormatter']) + $this->output = $this->getMockBuilder(ConsoleOutput::class) + ->onlyMethods(['section', 'writeln', 'getFormatter']) ->getMock(); $self = $this; - $this->output->expects($this->any()) - ->method('section') - ->willReturn($this->output); /* We need format method to return a string */ $outputFormatter = $this->createMock(OutputFormatterInterface::class); @@ -82,12 +80,12 @@ class RepairTest extends TestCase { ->willReturn($outputFormatter); $this->output->expects($this->any()) ->method('writeln') - ->willReturnCallback(function ($line) use ($self) { + ->willReturnCallback(function ($line) use ($self): void { $self->outputLines .= $line . "\n"; }); } - public function emptyTestDataProvider() { + public static function dataEmptyTest(): array { /** directoryNames, expectedOutput */ return [ [ @@ -113,9 +111,7 @@ class RepairTest extends TestCase { ]; } - /** - * @dataProvider emptyTestDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataEmptyTest')] public function testEmptyExecute($directoryNames, $expectedOutput): void { $previewFolder = $this->getMockBuilder(Folder::class) ->getMock(); |