From 7f125551f50acec1339a9d7dd046274c8504530c Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Tue, 21 Oct 2025 14:40:56 +0200 Subject: [PATCH] chore: migrate `@small` and `@medium` to attributes Both are basically special groups, which we do not use. But they also had a special meaning in the past which now only works when set on the test class: They set the test timeout. So for `@small` we just remove them, for `@medium` we remove where not needed but keep it on the class where the full test class might make use of the adjusted timeout. Signed-off-by: Ferdinand Thiessen --- apps/files_sharing/tests/ApiTest.php | 46 +--------------- apps/files_sharing/tests/SharedMountTest.php | 3 -- .../files_sharing/tests/SharedStorageTest.php | 5 -- .../tests/UnshareChildrenTest.php | 3 -- apps/files_versions/tests/VersioningTest.php | 1 - tests/lib/Files/Cache/WatcherTest.php | 8 +-- tests/lib/Files/ViewTest.php | 52 +------------------ tests/lib/UrlGeneratorTest.php | 4 -- 8 files changed, 4 insertions(+), 118 deletions(-) diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index 8813d46b17d..4a4d04be5c4 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -47,6 +47,7 @@ use Test\Traits\EmailValidatorTrait; /** * Class ApiTest */ +#[\PHPUnit\Framework\Attributes\Medium] #[\PHPUnit\Framework\Attributes\Group('DB')] class ApiTest extends TestCase { use EmailValidatorTrait; @@ -183,7 +184,6 @@ class ApiTest extends TestCase { $ocs->cleanup(); } - public function testCreateShareGroupFile(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->filename, Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1); @@ -323,9 +323,6 @@ class ApiTest extends TestCase { $this->addToAssertionCount(1); } - /** - * @medium - */ public function testSharePermissions(): void { // sharing file to a user should work if shareapi_exclude_groups is set // to no @@ -373,10 +370,6 @@ class ApiTest extends TestCase { $this->addToAssertionCount(1); } - - /** - * @medium - */ public function testGetAllShares(): void { $node = $this->userFolder->get($this->filename); @@ -434,9 +427,6 @@ class ApiTest extends TestCase { $this->shareManager->deleteShare($share2); } - /** - * @medium - */ #[\PHPUnit\Framework\Attributes\Group('RoutingWeirdness')] public function testPublicLinkUrl(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); @@ -482,9 +472,6 @@ class ApiTest extends TestCase { $ocs->cleanup(); } - /** - * @medium - */ #[\PHPUnit\Framework\Attributes\Depends('testCreateShareUserFile')] #[\PHPUnit\Framework\Attributes\Depends('testCreateShareLink')] public function testGetShareFromSource(): void { @@ -515,9 +502,6 @@ class ApiTest extends TestCase { $this->shareManager->deleteShare($share2); } - /** - * @medium - */ #[\PHPUnit\Framework\Attributes\Depends('testCreateShareUserFile')] #[\PHPUnit\Framework\Attributes\Depends('testCreateShareLink')] public function testGetShareFromSourceWithReshares(): void { @@ -557,9 +541,6 @@ class ApiTest extends TestCase { $this->shareManager->deleteShare($share2); } - /** - * @medium - */ #[\PHPUnit\Framework\Attributes\Depends('testCreateShareUserFile')] public function testGetShareFromId(): void { $node = $this->userFolder->get($this->filename); @@ -582,9 +563,6 @@ class ApiTest extends TestCase { $this->shareManager->deleteShare($share1); } - /** - * @medium - */ public function testGetShareFromFolder(): void { $node1 = $this->userFolder->get($this->filename); $share1 = $this->shareManager->newShare(); @@ -603,7 +581,6 @@ class ApiTest extends TestCase { ->setPermissions(1); $share2 = $this->shareManager->createShare($share2); - $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->getShares('false', 'false', 'true', $this->folder); $ocs->cleanup(); @@ -639,7 +616,6 @@ class ApiTest extends TestCase { /** * share a folder, than reshare a file within the shared folder and check if we construct the correct path - * @medium */ public function testGetShareFromFolderReshares(): void { $node1 = $this->userFolder->get($this->folder); @@ -699,7 +675,6 @@ class ApiTest extends TestCase { /** * reshare a sub folder and check if we get the correct path - * @medium */ public function testGetShareFromSubFolderReShares(): void { $node1 = $this->userFolder->get($this->folder . $this->subfolder); @@ -741,7 +716,6 @@ class ApiTest extends TestCase { /** * test re-re-share of folder if the path gets constructed correctly - * @medium */ public function XtestGetShareFromFolderReReShares() { $node1 = $this->userFolder->get($this->folder . $this->subfolder); @@ -818,7 +792,6 @@ class ApiTest extends TestCase { /** * test multiple shared folder if the path gets constructed correctly - * @medium */ public function testGetShareMultipleSharedFolder(): void { $this->setUp(); @@ -883,7 +856,6 @@ class ApiTest extends TestCase { /** * test re-re-share of folder if the path gets constructed correctly - * @medium */ public function testGetShareFromFileReReShares(): void { $node1 = $this->userFolder->get($this->folder . $this->subfolder); @@ -937,9 +909,6 @@ class ApiTest extends TestCase { $this->shareManager->deleteShare($share3); } - /** - * @medium - */ public function testGetShareFromUnknownId(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER3); try { @@ -951,9 +920,6 @@ class ApiTest extends TestCase { $ocs->cleanup(); } - /** - * @medium - */ #[\PHPUnit\Framework\Attributes\Depends('testCreateShareUserFile')] #[\PHPUnit\Framework\Attributes\Depends('testCreateShareLink')] public function testUpdateShare(): void { @@ -1013,9 +979,6 @@ class ApiTest extends TestCase { $this->shareManager->deleteShare($share2); } - /** - * @medium - */ #[\PHPUnit\Framework\Attributes\DataProvider('dataAllowFederationOnPublicShares')] public function testUpdateShareUpload(array $appConfig, int $permissions): void { $this->appConfig->method('getValueBool')->willReturnMap([ @@ -1056,9 +1019,6 @@ class ApiTest extends TestCase { ]; } - /** - * @medium - */ public function testUpdateShareExpireDate(): void { $node1 = $this->userFolder->get($this->folder); $share1 = $this->shareManager->newShare(); @@ -1119,7 +1079,6 @@ class ApiTest extends TestCase { $share1 = $this->shareManager->getShareById($share1->getFullId()); - // date shouldn't be changed $this->assertEquals($dateWithinRange, $share1->getExpirationDate()); // cleanup @@ -1128,9 +1087,6 @@ class ApiTest extends TestCase { $this->shareManager->deleteShare($share1); } - /** - * @medium - */ #[\PHPUnit\Framework\Attributes\Depends('testCreateShareUserFile')] public function testDeleteShare(): void { $node1 = $this->userFolder->get($this->filename); diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php index 2741f51dd10..bfc0016d318 100644 --- a/apps/files_sharing/tests/SharedMountTest.php +++ b/apps/files_sharing/tests/SharedMountTest.php @@ -100,9 +100,6 @@ class SharedMountTest extends TestCase { $this->view->unlink($this->folder); } - /** - * @medium - */ public function testDeleteParentOfMountPoint(): void { // share to user $share = $this->share( diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php index 8806721f6f6..f437238e6d9 100644 --- a/apps/files_sharing/tests/SharedStorageTest.php +++ b/apps/files_sharing/tests/SharedStorageTest.php @@ -62,8 +62,6 @@ class SharedStorageTest extends TestCase { /** * if the parent of the mount point is gone then the mount point should move up - * - * @medium */ public function testParentOfMountPointIsGone(): void { @@ -107,9 +105,6 @@ class SharedStorageTest extends TestCase { $this->view->unlink($this->folder); } - /** - * @medium - */ public function testRenamePartFile(): void { // share to user diff --git a/apps/files_sharing/tests/UnshareChildrenTest.php b/apps/files_sharing/tests/UnshareChildrenTest.php index 0a12c02b9a8..cabb3812c02 100644 --- a/apps/files_sharing/tests/UnshareChildrenTest.php +++ b/apps/files_sharing/tests/UnshareChildrenTest.php @@ -55,9 +55,6 @@ class UnshareChildrenTest extends TestCase { parent::tearDown(); } - /** - * @medium - */ public function testUnshareChildren(): void { $fileInfo2 = Filesystem::getFileInfo($this->folder); diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php index a430f131e78..0783032863e 100644 --- a/apps/files_versions/tests/VersioningTest.php +++ b/apps/files_versions/tests/VersioningTest.php @@ -137,7 +137,6 @@ class VersioningTest extends \Test\TestCase { } /** - * @medium * test expire logic */ #[\PHPUnit\Framework\Attributes\DataProvider('versionsProvider')] diff --git a/tests/lib/Files/Cache/WatcherTest.php b/tests/lib/Files/Cache/WatcherTest.php index fecafb004b7..a7fa5086b7b 100644 --- a/tests/lib/Files/Cache/WatcherTest.php +++ b/tests/lib/Files/Cache/WatcherTest.php @@ -18,6 +18,7 @@ use OC\Files\Storage\Temporary; * * @package Test\Files\Cache */ +#[\PHPUnit\Framework\Attributes\Medium] #[\PHPUnit\Framework\Attributes\Group('DB')] class WatcherTest extends \Test\TestCase { /** @@ -42,9 +43,6 @@ class WatcherTest extends \Test\TestCase { parent::tearDown(); } - /** - * @medium - */ public function testWatcher(): void { $storage = $this->getTestStorage(); $cache = $storage->getCache(); @@ -83,9 +81,7 @@ class WatcherTest extends \Test\TestCase { $this->assertFalse($cache->inCache('folder/bar2.txt')); } - /** - * @medium - */ + public function testFileToFolder(): void { $storage = $this->getTestStorage(); $cache = $storage->getCache(); diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index 3a6a223b135..57424107401 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -93,6 +93,7 @@ class TestEventHandler { * * @package Test\Files */ +#[\PHPUnit\Framework\Attributes\Medium] #[\PHPUnit\Framework\Attributes\Group('DB')] class ViewTest extends \Test\TestCase { use UserTrait; @@ -172,9 +173,6 @@ class ViewTest extends \Test\TestCase { parent::tearDown(); } - /** - * @medium - */ public function testCacheAPI(): void { $storage1 = $this->getTestStorage(); $storage2 = $this->getTestStorage(); @@ -255,9 +253,6 @@ class ViewTest extends \Test\TestCase { $this->assertEquals([], $rootView->getDirectoryContent('/non/existing')); } - /** - * @medium - */ public function testGetPath(): void { $user = $this->createMock(IUser::class); $user->method('getUID') @@ -307,9 +302,6 @@ class ViewTest extends \Test\TestCase { $this->assertNull($folderView->getPath($id1)); } - /** - * @medium - */ public function testMountPointOverwrite(): void { $storage1 = $this->getTestStorage(false); $storage2 = $this->getTestStorage(); @@ -391,9 +383,6 @@ class ViewTest extends \Test\TestCase { $this->assertEquals($textSize, $folderData[0]['size']); } - /** - * @medium - */ public function testSearch(): void { $storage1 = $this->getTestStorage(); $storage2 = $this->getTestStorage(); @@ -441,9 +430,6 @@ class ViewTest extends \Test\TestCase { $this->assertCount(3, $folderView->searchByMime('text')); } - /** - * @medium - */ public function testWatcher(): void { $storage1 = $this->getTestStorage(); Filesystem::mount($storage1, [], '/'); @@ -462,27 +448,18 @@ class ViewTest extends \Test\TestCase { $this->assertEquals(3, $cachedData['size']); } - /** - * @medium - */ public function testCopyBetweenStorageNoCross(): void { $storage1 = $this->getTestStorage(true, TemporaryNoCross::class); $storage2 = $this->getTestStorage(true, TemporaryNoCross::class); $this->copyBetweenStorages($storage1, $storage2); } - /** - * @medium - */ public function testCopyBetweenStorageCross(): void { $storage1 = $this->getTestStorage(); $storage2 = $this->getTestStorage(); $this->copyBetweenStorages($storage1, $storage2); } - /** - * @medium - */ public function testCopyBetweenStorageCrossNonLocal(): void { $storage1 = $this->getTestStorage(true, TemporaryNoLocal::class); $storage2 = $this->getTestStorage(true, TemporaryNoLocal::class); @@ -508,27 +485,18 @@ class ViewTest extends \Test\TestCase { $this->assertTrue($rootView->file_exists('/substorage/folder/bar.txt')); } - /** - * @medium - */ public function testMoveBetweenStorageNoCross(): void { $storage1 = $this->getTestStorage(true, TemporaryNoCross::class); $storage2 = $this->getTestStorage(true, TemporaryNoCross::class); $this->moveBetweenStorages($storage1, $storage2); } - /** - * @medium - */ public function testMoveBetweenStorageCross(): void { $storage1 = $this->getTestStorage(); $storage2 = $this->getTestStorage(); $this->moveBetweenStorages($storage1, $storage2); } - /** - * @medium - */ public function testMoveBetweenStorageCrossNonLocal(): void { $storage1 = $this->getTestStorage(true, TemporaryNoLocal::class); $storage2 = $this->getTestStorage(true, TemporaryNoLocal::class); @@ -549,9 +517,6 @@ class ViewTest extends \Test\TestCase { $this->assertTrue($rootView->file_exists('anotherfolder/bar.txt')); } - /** - * @medium - */ public function testUnlink(): void { $storage1 = $this->getTestStorage(); $storage2 = $this->getTestStorage(); @@ -593,9 +558,6 @@ class ViewTest extends \Test\TestCase { $this->assertFalse($rootView->file_exists('sub')); } - /** - * @medium - */ public function testUnlinkRootMustFail(): void { $storage1 = $this->getTestStorage(); $storage2 = $this->getTestStorage(); @@ -612,9 +574,6 @@ class ViewTest extends \Test\TestCase { $this->assertFalse($rootView->unlink('/substorage')); } - /** - * @medium - */ public function testTouch(): void { $storage = $this->getTestStorage(true, TemporaryNoTouch::class); @@ -636,9 +595,6 @@ class ViewTest extends \Test\TestCase { $this->assertEquals($cachedData['storage_mtime'], $cachedData['mtime']); } - /** - * @medium - */ public function testTouchFloat(): void { $storage = $this->getTestStorage(true, TemporaryNoTouch::class); @@ -653,9 +609,6 @@ class ViewTest extends \Test\TestCase { $this->assertEquals(500, $cachedData['mtime']); } - /** - * @medium - */ public function testViewHooks(): void { $storage1 = $this->getTestStorage(); $storage2 = $this->getTestStorage(); @@ -719,9 +672,6 @@ class ViewTest extends \Test\TestCase { return $storage; } - /** - * @medium - */ public function testViewHooksIfRootStartsTheSame(): void { $storage1 = $this->getTestStorage(); $storage2 = $this->getTestStorage(); diff --git a/tests/lib/UrlGeneratorTest.php b/tests/lib/UrlGeneratorTest.php index e8f88d8f35b..b91c3e41ea8 100644 --- a/tests/lib/UrlGeneratorTest.php +++ b/tests/lib/UrlGeneratorTest.php @@ -69,7 +69,6 @@ class UrlGeneratorTest extends \Test\TestCase { } /** - * @small * test linkTo URL construction */ #[\PHPUnit\Framework\Attributes\DataProvider('provideDocRootAppUrlParts')] @@ -80,7 +79,6 @@ class UrlGeneratorTest extends \Test\TestCase { } /** - * @small * test linkTo URL construction in sub directory */ #[\PHPUnit\Framework\Attributes\DataProvider('provideSubDirAppUrlParts')] @@ -131,7 +129,6 @@ class UrlGeneratorTest extends \Test\TestCase { } /** - * @small * test absolute URL construction */ #[\PHPUnit\Framework\Attributes\DataProvider('provideDocRootURLs')] @@ -143,7 +140,6 @@ class UrlGeneratorTest extends \Test\TestCase { } /** - * @small * test absolute URL construction */ #[\PHPUnit\Framework\Attributes\DataProvider('provideSubDirURLs')]