aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/tests/Command/DeleteOrphanedFilesTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/tests/Command/DeleteOrphanedFilesTest.php')
-rw-r--r--apps/files/tests/Command/DeleteOrphanedFilesTest.php27
1 files changed, 14 insertions, 13 deletions
diff --git a/apps/files/tests/Command/DeleteOrphanedFilesTest.php b/apps/files/tests/Command/DeleteOrphanedFilesTest.php
index 389ede2a74d..54b5ac6c12f 100644
--- a/apps/files/tests/Command/DeleteOrphanedFilesTest.php
+++ b/apps/files/tests/Command/DeleteOrphanedFilesTest.php
@@ -1,5 +1,6 @@
<?php
+declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -56,7 +57,7 @@ class DeleteOrphanedFilesTest extends TestCase {
parent::tearDown();
}
- protected function getFile($fileId) {
+ protected function getFile(int $fileId): array {
$query = $this->connection->getQueryBuilder();
$query->select('*')
->from('filecache')
@@ -64,7 +65,7 @@ class DeleteOrphanedFilesTest extends TestCase {
return $query->executeQuery()->fetchAll();
}
- protected function getMounts($storageId) {
+ protected function getMounts(int $storageId): array {
$query = $this->connection->getQueryBuilder();
$query->select('*')
->from('mounts')
@@ -76,12 +77,8 @@ class DeleteOrphanedFilesTest extends TestCase {
* Test clearing orphaned files
*/
public function testClearFiles(): void {
- $input = $this->getMockBuilder(InputInterface::class)
- ->disableOriginalConstructor()
- ->getMock();
- $output = $this->getMockBuilder(OutputInterface::class)
- ->disableOriginalConstructor()
- ->getMock();
+ $input = $this->createMock(InputInterface::class);
+ $output = $this->createMock(OutputInterface::class);
$rootFolder = Server::get(IRootFolder::class);
@@ -112,14 +109,18 @@ class DeleteOrphanedFilesTest extends TestCase {
$this->assertSame(1, $deletedRows, 'Asserts that storage got deleted');
// parent folder, `files`, ´test` and `welcome.txt` => 4 elements
+ $calls = [
+ '3 orphaned file cache entries deleted',
+ '0 orphaned file cache extended entries deleted',
+ '1 orphaned mount entries deleted',
+ ];
$output
->expects($this->exactly(3))
->method('writeln')
- ->withConsecutive(
- ['3 orphaned file cache entries deleted'],
- ['0 orphaned file cache extended entries deleted'],
- ['1 orphaned mount entries deleted'],
- );
+ ->willReturnCallback(function (string $message) use (&$calls) {
+ $expected = array_shift($calls);
+ $this->assertSame($expected, $message);
+ });
$this->command->execute($input, $output);