diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2024-09-15 22:32:31 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2024-09-15 22:32:31 +0200 |
commit | 49dd79eabb2b8902559a7a4e8f8fcad54f46b604 (patch) | |
tree | 2af18db46ba463368dc4461d7436fb69577923de /apps/files/tests | |
parent | 4281ce6fa1bb8235426099d720734d2394bec203 (diff) | |
download | nextcloud-server-49dd79eabb2b8902559a7a4e8f8fcad54f46b604.tar.gz nextcloud-server-49dd79eabb2b8902559a7a4e8f8fcad54f46b604.zip |
refactor: Add void return type to PHPUnit test methods
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/files/tests')
-rw-r--r-- | apps/files/tests/Activity/Filter/GenericTest.php | 14 | ||||
-rw-r--r-- | apps/files/tests/Activity/ProviderTest.php | 4 | ||||
-rw-r--r-- | apps/files/tests/Activity/Setting/GenericTest.php | 16 | ||||
-rw-r--r-- | apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php | 8 | ||||
-rw-r--r-- | apps/files/tests/BackgroundJob/ScanFilesTest.php | 4 | ||||
-rw-r--r-- | apps/files/tests/Command/DeleteOrphanedFilesTest.php | 2 | ||||
-rw-r--r-- | apps/files/tests/Controller/ApiControllerTest.php | 22 | ||||
-rw-r--r-- | apps/files/tests/Controller/ViewControllerTest.php | 4 | ||||
-rw-r--r-- | apps/files/tests/HelperTest.php | 4 | ||||
-rw-r--r-- | apps/files/tests/Service/TagServiceTest.php | 4 |
10 files changed, 41 insertions, 41 deletions
diff --git a/apps/files/tests/Activity/Filter/GenericTest.php b/apps/files/tests/Activity/Filter/GenericTest.php index 6f4dd594582..347bea0f643 100644 --- a/apps/files/tests/Activity/Filter/GenericTest.php +++ b/apps/files/tests/Activity/Filter/GenericTest.php @@ -28,7 +28,7 @@ class GenericTest extends TestCase { * @dataProvider dataFilters * @param string $filterClass */ - public function testImplementsInterface($filterClass) { + public function testImplementsInterface($filterClass): void { $filter = \OC::$server->query($filterClass); $this->assertInstanceOf(IFilter::class, $filter); } @@ -37,7 +37,7 @@ class GenericTest extends TestCase { * @dataProvider dataFilters * @param string $filterClass */ - public function testGetIdentifier($filterClass) { + public function testGetIdentifier($filterClass): void { /** @var IFilter $filter */ $filter = \OC::$server->query($filterClass); $this->assertIsString($filter->getIdentifier()); @@ -47,7 +47,7 @@ class GenericTest extends TestCase { * @dataProvider dataFilters * @param string $filterClass */ - public function testGetName($filterClass) { + public function testGetName($filterClass): void { /** @var IFilter $filter */ $filter = \OC::$server->query($filterClass); $this->assertIsString($filter->getName()); @@ -57,7 +57,7 @@ class GenericTest extends TestCase { * @dataProvider dataFilters * @param string $filterClass */ - public function testGetPriority($filterClass) { + public function testGetPriority($filterClass): void { /** @var IFilter $filter */ $filter = \OC::$server->query($filterClass); $priority = $filter->getPriority(); @@ -70,7 +70,7 @@ class GenericTest extends TestCase { * @dataProvider dataFilters * @param string $filterClass */ - public function testGetIcon($filterClass) { + public function testGetIcon($filterClass): void { /** @var IFilter $filter */ $filter = \OC::$server->query($filterClass); $this->assertIsString($filter->getIcon()); @@ -81,7 +81,7 @@ class GenericTest extends TestCase { * @dataProvider dataFilters * @param string $filterClass */ - public function testFilterTypes($filterClass) { + public function testFilterTypes($filterClass): void { /** @var IFilter $filter */ $filter = \OC::$server->query($filterClass); $this->assertIsArray($filter->filterTypes([])); @@ -91,7 +91,7 @@ class GenericTest extends TestCase { * @dataProvider dataFilters * @param string $filterClass */ - public function testAllowedApps($filterClass) { + public function testAllowedApps($filterClass): void { /** @var IFilter $filter */ $filter = \OC::$server->query($filterClass); $this->assertIsArray($filter->allowedApps()); diff --git a/apps/files/tests/Activity/ProviderTest.php b/apps/files/tests/Activity/ProviderTest.php index 1716ccfe100..73c726dac3c 100644 --- a/apps/files/tests/Activity/ProviderTest.php +++ b/apps/files/tests/Activity/ProviderTest.php @@ -104,7 +104,7 @@ class ProviderTest extends TestCase { * @param string $name * @param string $path */ - public function testGetFile($parameter, $eventId, $id, $name, $path) { + public function testGetFile($parameter, $eventId, $id, $name, $path): void { $provider = $this->getProvider(); if ($eventId !== null) { @@ -131,7 +131,7 @@ class ProviderTest extends TestCase { } - public function testGetFileThrows() { + public function testGetFileThrows(): void { $this->expectException(\InvalidArgumentException::class); $provider = $this->getProvider(); diff --git a/apps/files/tests/Activity/Setting/GenericTest.php b/apps/files/tests/Activity/Setting/GenericTest.php index c124106140a..1cce876cbcf 100644 --- a/apps/files/tests/Activity/Setting/GenericTest.php +++ b/apps/files/tests/Activity/Setting/GenericTest.php @@ -23,7 +23,7 @@ class GenericTest extends TestCase { * @dataProvider dataSettings * @param string $settingClass */ - public function testImplementsInterface($settingClass) { + public function testImplementsInterface($settingClass): void { $setting = \OC::$server->query($settingClass); $this->assertInstanceOf(ISetting::class, $setting); } @@ -32,7 +32,7 @@ class GenericTest extends TestCase { * @dataProvider dataSettings * @param string $settingClass */ - public function testGetIdentifier($settingClass) { + public function testGetIdentifier($settingClass): void { /** @var ISetting $setting */ $setting = \OC::$server->query($settingClass); $this->assertIsString($setting->getIdentifier()); @@ -42,7 +42,7 @@ class GenericTest extends TestCase { * @dataProvider dataSettings * @param string $settingClass */ - public function testGetName($settingClass) { + public function testGetName($settingClass): void { /** @var ISetting $setting */ $setting = \OC::$server->query($settingClass); $this->assertIsString($setting->getName()); @@ -52,7 +52,7 @@ class GenericTest extends TestCase { * @dataProvider dataSettings * @param string $settingClass */ - public function testGetPriority($settingClass) { + public function testGetPriority($settingClass): void { /** @var ISetting $setting */ $setting = \OC::$server->query($settingClass); $priority = $setting->getPriority(); @@ -65,7 +65,7 @@ class GenericTest extends TestCase { * @dataProvider dataSettings * @param string $settingClass */ - public function testCanChangeStream($settingClass) { + public function testCanChangeStream($settingClass): void { /** @var ISetting $setting */ $setting = \OC::$server->query($settingClass); $this->assertIsBool($setting->canChangeStream()); @@ -75,7 +75,7 @@ class GenericTest extends TestCase { * @dataProvider dataSettings * @param string $settingClass */ - public function testIsDefaultEnabledStream($settingClass) { + public function testIsDefaultEnabledStream($settingClass): void { /** @var ISetting $setting */ $setting = \OC::$server->query($settingClass); $this->assertIsBool($setting->isDefaultEnabledStream()); @@ -85,7 +85,7 @@ class GenericTest extends TestCase { * @dataProvider dataSettings * @param string $settingClass */ - public function testCanChangeMail($settingClass) { + public function testCanChangeMail($settingClass): void { /** @var ISetting $setting */ $setting = \OC::$server->query($settingClass); $this->assertIsBool($setting->canChangeMail()); @@ -95,7 +95,7 @@ class GenericTest extends TestCase { * @dataProvider dataSettings * @param string $settingClass */ - public function testIsDefaultEnabledMail($settingClass) { + public function testIsDefaultEnabledMail($settingClass): void { /** @var ISetting $setting */ $setting = \OC::$server->query($settingClass); $this->assertIsBool($setting->isDefaultEnabledMail()); diff --git a/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php b/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php index fb8ff9884af..1ce2d7bd8f7 100644 --- a/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php +++ b/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php @@ -51,7 +51,7 @@ class DeleteOrphanedItemsJobTest extends \Test\TestCase { /** * Test clearing orphaned system tag mappings */ - public function testClearSystemTagMappings() { + public function testClearSystemTagMappings(): void { $this->cleanMapping('systemtag_object_mapping'); $query = $this->connection->getQueryBuilder(); @@ -100,7 +100,7 @@ class DeleteOrphanedItemsJobTest extends \Test\TestCase { /** * Test clearing orphaned system tag mappings */ - public function testClearUserTagMappings() { + public function testClearUserTagMappings(): void { $this->cleanMapping('vcategory_to_object'); $query = $this->connection->getQueryBuilder(); @@ -149,7 +149,7 @@ class DeleteOrphanedItemsJobTest extends \Test\TestCase { /** * Test clearing orphaned system tag mappings */ - public function testClearComments() { + public function testClearComments(): void { $this->cleanMapping('comments'); $query = $this->connection->getQueryBuilder(); @@ -200,7 +200,7 @@ class DeleteOrphanedItemsJobTest extends \Test\TestCase { /** * Test clearing orphaned system tag mappings */ - public function testClearCommentReadMarks() { + public function testClearCommentReadMarks(): void { $this->cleanMapping('comments_read_markers'); $query = $this->connection->getQueryBuilder(); diff --git a/apps/files/tests/BackgroundJob/ScanFilesTest.php b/apps/files/tests/BackgroundJob/ScanFilesTest.php index e4ba8348d64..0fb5163143f 100644 --- a/apps/files/tests/BackgroundJob/ScanFilesTest.php +++ b/apps/files/tests/BackgroundJob/ScanFilesTest.php @@ -79,7 +79,7 @@ class ScanFilesTest extends TestCase { return $storage; } - public function testAllScanned() { + public function testAllScanned(): void { $this->setupStorage('foouser', '/foousers/files/foo'); $this->scanFiles->expects($this->never()) @@ -87,7 +87,7 @@ class ScanFilesTest extends TestCase { $this->runJob(); } - public function testUnscanned() { + public function testUnscanned(): void { $storage = $this->setupStorage('foouser', '/foousers/files/foo'); $storage->getCache()->put('foo', ['size' => -1]); diff --git a/apps/files/tests/Command/DeleteOrphanedFilesTest.php b/apps/files/tests/Command/DeleteOrphanedFilesTest.php index ed9a1866d26..1205e204ec4 100644 --- a/apps/files/tests/Command/DeleteOrphanedFilesTest.php +++ b/apps/files/tests/Command/DeleteOrphanedFilesTest.php @@ -82,7 +82,7 @@ class DeleteOrphanedFilesTest extends TestCase { /** * Test clearing orphaned files */ - public function testClearFiles() { + public function testClearFiles(): void { $input = $this->getMockBuilder(InputInterface::class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/files/tests/Controller/ApiControllerTest.php b/apps/files/tests/Controller/ApiControllerTest.php index f79a5c7bb64..ad2a6a15b2b 100644 --- a/apps/files/tests/Controller/ApiControllerTest.php +++ b/apps/files/tests/Controller/ApiControllerTest.php @@ -113,12 +113,12 @@ class ApiControllerTest extends TestCase { ); } - public function testUpdateFileTagsEmpty() { + public function testUpdateFileTagsEmpty(): void { $expected = new DataResponse([]); $this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt')); } - public function testUpdateFileTagsWorking() { + public function testUpdateFileTagsWorking(): void { $this->tagService->expects($this->once()) ->method('updateFileTags') ->with('/path.txt', ['Tag1', 'Tag2']); @@ -132,7 +132,7 @@ class ApiControllerTest extends TestCase { $this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt', ['Tag1', 'Tag2'])); } - public function testUpdateFileTagsNotFoundException() { + public function testUpdateFileTagsNotFoundException(): void { $this->tagService->expects($this->once()) ->method('updateFileTags') ->with('/path.txt', ['Tag1', 'Tag2']) @@ -142,7 +142,7 @@ class ApiControllerTest extends TestCase { $this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt', ['Tag1', 'Tag2'])); } - public function testUpdateFileTagsStorageNotAvailableException() { + public function testUpdateFileTagsStorageNotAvailableException(): void { $this->tagService->expects($this->once()) ->method('updateFileTags') ->with('/path.txt', ['Tag1', 'Tag2']) @@ -152,7 +152,7 @@ class ApiControllerTest extends TestCase { $this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt', ['Tag1', 'Tag2'])); } - public function testUpdateFileTagsStorageGenericException() { + public function testUpdateFileTagsStorageGenericException(): void { $this->tagService->expects($this->once()) ->method('updateFileTags') ->with('/path.txt', ['Tag1', 'Tag2']) @@ -162,7 +162,7 @@ class ApiControllerTest extends TestCase { $this->assertEquals($expected, $this->apiController->updateFileTags('/path.txt', ['Tag1', 'Tag2'])); } - public function testGetThumbnailInvalidSize() { + public function testGetThumbnailInvalidSize(): void { $this->userFolder->method('get') ->with($this->equalTo('')) ->willThrowException(new NotFoundException()); @@ -170,7 +170,7 @@ class ApiControllerTest extends TestCase { $this->assertEquals($expected, $this->apiController->getThumbnail(0, 0, '')); } - public function testGetThumbnailInvalidImage() { + public function testGetThumbnailInvalidImage(): void { $file = $this->createMock(File::class); $file->method('getId')->willReturn(123); $this->userFolder->method('get') @@ -184,7 +184,7 @@ class ApiControllerTest extends TestCase { $this->assertEquals($expected, $this->apiController->getThumbnail(10, 10, 'unknown.jpg')); } - public function testGetThumbnailInvalidPartFile() { + public function testGetThumbnailInvalidPartFile(): void { $file = $this->createMock(File::class); $file->method('getId')->willReturn(0); $this->userFolder->method('get') @@ -194,7 +194,7 @@ class ApiControllerTest extends TestCase { $this->assertEquals($expected, $this->apiController->getThumbnail(10, 10, 'unknown.jpg')); } - public function testGetThumbnail() { + public function testGetThumbnail(): void { $file = $this->createMock(File::class); $file->method('getId')->willReturn(123); $this->userFolder->method('get') @@ -214,7 +214,7 @@ class ApiControllerTest extends TestCase { $this->assertInstanceOf(Http\FileDisplayResponse::class, $ret); } - public function testShowHiddenFiles() { + public function testShowHiddenFiles(): void { $show = false; $this->config->expects($this->once()) @@ -227,7 +227,7 @@ class ApiControllerTest extends TestCase { $this->assertEquals($expected, $actual); } - public function testCropImagePreviews() { + public function testCropImagePreviews(): void { $crop = true; $this->config->expects($this->once()) diff --git a/apps/files/tests/Controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php index c1bc27d42b5..a6eba1f9eaf 100644 --- a/apps/files/tests/Controller/ViewControllerTest.php +++ b/apps/files/tests/Controller/ViewControllerTest.php @@ -97,7 +97,7 @@ class ViewControllerTest extends TestCase { ->getMock(); } - public function testIndexWithRegularBrowser() { + public function testIndexWithRegularBrowser(): void { $this->viewController ->expects($this->any()) ->method('getStorageInfo') @@ -145,7 +145,7 @@ class ViewControllerTest extends TestCase { $this->assertEquals($expected, $this->viewController->index('MyDir', 'MyView')); } - public function testShowFileRouteWithTrashedFile() { + public function testShowFileRouteWithTrashedFile(): void { $this->appManager->expects($this->once()) ->method('isEnabledForUser') ->with('files_trashbin') diff --git a/apps/files/tests/HelperTest.php b/apps/files/tests/HelperTest.php index 2bafb25dffa..fdcef8f7125 100644 --- a/apps/files/tests/HelperTest.php +++ b/apps/files/tests/HelperTest.php @@ -74,7 +74,7 @@ class HelperTest extends \Test\TestCase { /** * @dataProvider sortDataProvider */ - public function testSortByName(string $sort, bool $sortDescending, array $expectedOrder) { + public function testSortByName(string $sort, bool $sortDescending, array $expectedOrder): void { if (($sort === 'mtime') && (PHP_INT_SIZE < 8)) { $this->markTestSkipped('Skip mtime sorting on 32bit'); } @@ -90,7 +90,7 @@ class HelperTest extends \Test\TestCase { ); } - public function testPopulateTags() { + public function testPopulateTags(): void { $tagManager = $this->createMock(\OCP\ITagManager::class); $tagger = $this->createMock(\OCP\ITags::class); diff --git a/apps/files/tests/Service/TagServiceTest.php b/apps/files/tests/Service/TagServiceTest.php index 7a2084f21d8..7922c45a639 100644 --- a/apps/files/tests/Service/TagServiceTest.php +++ b/apps/files/tests/Service/TagServiceTest.php @@ -101,7 +101,7 @@ class TagServiceTest extends \Test\TestCase { } } - public function testUpdateFileTags() { + public function testUpdateFileTags(): void { $tag1 = 'tag1'; $tag2 = 'tag2'; @@ -142,7 +142,7 @@ class TagServiceTest extends \Test\TestCase { $subdir->delete(); } - public function testFavoriteActivity() { + public function testFavoriteActivity(): void { $subdir = $this->root->newFolder('subdir'); $file = $subdir->newFile('test.txt'); |