aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Core/Command/Preview/RepairTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Core/Command/Preview/RepairTest.php')
-rw-r--r--tests/Core/Command/Preview/RepairTest.php24
1 files changed, 10 insertions, 14 deletions
diff --git a/tests/Core/Command/Preview/RepairTest.php b/tests/Core/Command/Preview/RepairTest.php
index b257c59d9d2..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,10 +111,8 @@ class RepairTest extends TestCase {
];
}
- /**
- * @dataProvider emptyTestDataProvider
- */
- public function testEmptyExecute($directoryNames, $expectedOutput) {
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataEmptyTest')]
+ public function testEmptyExecute($directoryNames, $expectedOutput): void {
$previewFolder = $this->getMockBuilder(Folder::class)
->getMock();
$directories = array_map(function ($element) {
@@ -147,7 +143,7 @@ class RepairTest extends TestCase {
->willReturn($directories);
$this->rootFolder->expects($this->once())
->method('get')
- ->with("appdata_/preview")
+ ->with('appdata_/preview')
->willReturn($previewFolder);
$this->repair->run($this->input, $this->output);