diff options
Diffstat (limited to 'apps/theming/tests')
-rw-r--r-- | apps/theming/tests/CapabilitiesTest.php | 2 | ||||
-rw-r--r-- | apps/theming/tests/Controller/IconControllerTest.php | 12 | ||||
-rw-r--r-- | apps/theming/tests/Controller/ThemingControllerTest.php | 28 | ||||
-rw-r--r-- | apps/theming/tests/Controller/UserThemeControllerTest.php | 8 | ||||
-rw-r--r-- | apps/theming/tests/IconBuilderTest.php | 12 | ||||
-rw-r--r-- | apps/theming/tests/ImageManagerTest.php | 6 | ||||
-rw-r--r-- | apps/theming/tests/Service/ThemesServiceTest.php | 9 | ||||
-rw-r--r-- | apps/theming/tests/ServicesTest.php | 4 | ||||
-rw-r--r-- | apps/theming/tests/Settings/PersonalTest.php | 3 | ||||
-rw-r--r-- | apps/theming/tests/Themes/AccessibleThemeTestCase.php | 4 | ||||
-rw-r--r-- | apps/theming/tests/Themes/DyslexiaFontTest.php | 3 | ||||
-rw-r--r-- | apps/theming/tests/ThemingDefaultsTest.php | 24 | ||||
-rw-r--r-- | apps/theming/tests/UtilTest.php | 20 |
13 files changed, 40 insertions, 95 deletions
diff --git a/apps/theming/tests/CapabilitiesTest.php b/apps/theming/tests/CapabilitiesTest.php index 16cc6d51ba9..aa08a45a28b 100644 --- a/apps/theming/tests/CapabilitiesTest.php +++ b/apps/theming/tests/CapabilitiesTest.php @@ -128,9 +128,9 @@ class CapabilitiesTest extends TestCase { } /** - * @dataProvider dataGetCapabilities * @param non-empty-array<string, string> $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataGetCapabilities')] public function testGetCapabilities(string $name, string $url, string $slogan, string $color, string $textColor, string $logo, string $background, string $backgroundColor, string $backgroundTextColor, string $baseUrl, bool $backgroundThemed, array $expected): void { $this->config->expects($this->once()) ->method('getAppValue') diff --git a/apps/theming/tests/Controller/IconControllerTest.php b/apps/theming/tests/Controller/IconControllerTest.php index 329ad429bc5..c5034600e03 100644 --- a/apps/theming/tests/Controller/IconControllerTest.php +++ b/apps/theming/tests/Controller/IconControllerTest.php @@ -95,13 +95,13 @@ class IconControllerTest extends TestCase { $this->imageManager->expects($this->once()) ->method('getImage', false) ->with('favicon') - ->will($this->throwException(new NotFoundException())); + ->willThrowException(new NotFoundException()); $this->imageManager->expects($this->any()) ->method('shouldReplaceIcons') ->willReturn(true); $this->imageManager->expects($this->once()) ->method('getCachedImage') - ->will($this->throwException(new NotFoundException())); + ->willThrowException(new NotFoundException()); $this->iconBuilder->expects($this->once()) ->method('getFavicon') ->with('core') @@ -119,7 +119,7 @@ class IconControllerTest extends TestCase { $this->imageManager->expects($this->once()) ->method('getImage') ->with('favicon', false) - ->will($this->throwException(new NotFoundException())); + ->willThrowException(new NotFoundException()); $this->imageManager->expects($this->any()) ->method('shouldReplaceIcons') ->willReturn(false); @@ -144,7 +144,7 @@ class IconControllerTest extends TestCase { $this->imageManager->expects($this->once()) ->method('getImage') - ->will($this->throwException(new NotFoundException())); + ->willThrowException(new NotFoundException()); $this->imageManager->expects($this->any()) ->method('shouldReplaceIcons') ->willReturn(true); @@ -155,7 +155,7 @@ class IconControllerTest extends TestCase { $file = $this->iconFileMock('filename', 'filecontent'); $this->imageManager->expects($this->once()) ->method('getCachedImage') - ->will($this->throwException(new NotFoundException())); + ->willThrowException(new NotFoundException()); $this->imageManager->expects($this->once()) ->method('setCachedImage') ->willReturn($file); @@ -169,7 +169,7 @@ class IconControllerTest extends TestCase { $this->imageManager->expects($this->once()) ->method('getImage') ->with('favicon') - ->will($this->throwException(new NotFoundException())); + ->willThrowException(new NotFoundException()); $this->imageManager->expects($this->any()) ->method('shouldReplaceIcons') ->willReturn(false); diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php index 39debcef45f..fb461f03a28 100644 --- a/apps/theming/tests/Controller/ThemingControllerTest.php +++ b/apps/theming/tests/Controller/ThemingControllerTest.php @@ -97,9 +97,7 @@ class ThemingControllerTest extends TestCase { ]; } - /** - * @dataProvider dataUpdateStylesheetSuccess - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataUpdateStylesheetSuccess')] public function testUpdateStylesheetSuccess(string $setting, string $value, string $message): void { $this->themingDefaults ->expects($this->once()) @@ -155,9 +153,7 @@ class ThemingControllerTest extends TestCase { ]; } - /** - * @dataProvider dataUpdateStylesheetError - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataUpdateStylesheetError')] public function testUpdateStylesheetError(string $setting, string $value, string $message): void { $this->themingDefaults ->expects($this->never()) @@ -346,9 +342,7 @@ class ThemingControllerTest extends TestCase { ]; } - /** - * @dataProvider dataUpdateImages - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataUpdateImages')] public function testUpdateLogoNormalLogoUpload(string $mimeType, bool $folderExists = true): void { $tmpLogo = Server::get(ITempManager::class)->getTemporaryFolder() . '/logo.svg'; $destination = Server::get(ITempManager::class)->getTemporaryFolder(); @@ -504,9 +498,7 @@ class ThemingControllerTest extends TestCase { ]; } - /** - * @dataProvider dataPhpUploadErrors - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataPhpUploadErrors')] public function testUpdateLogoLoginScreenUploadWithInvalidImageUpload(int $error, string $expectedErrorMessage): void { $this->request ->expects($this->once()) @@ -543,9 +535,7 @@ class ThemingControllerTest extends TestCase { $this->assertEquals($expected, $this->themingController->uploadImage()); } - /** - * @dataProvider dataPhpUploadErrors - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataPhpUploadErrors')] public function testUpdateLogoUploadWithInvalidImageUpload($error, $expectedErrorMessage): void { $this->request ->expects($this->once()) @@ -614,9 +604,7 @@ class ThemingControllerTest extends TestCase { ]; } - /** - * @dataProvider dataUndoDelete - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataUndoDelete')] public function testUndoDelete(string $value, string $filename): void { $this->l10n ->expects($this->once()) @@ -716,9 +704,7 @@ class ThemingControllerTest extends TestCase { ]; } - /** - * @dataProvider dataGetManifest - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataGetManifest')] public function testGetManifest(bool $standalone): void { $this->config ->expects($this->once()) diff --git a/apps/theming/tests/Controller/UserThemeControllerTest.php b/apps/theming/tests/Controller/UserThemeControllerTest.php index b830bb5b065..9a8c1cd19aa 100644 --- a/apps/theming/tests/Controller/UserThemeControllerTest.php +++ b/apps/theming/tests/Controller/UserThemeControllerTest.php @@ -92,9 +92,7 @@ class UserThemeControllerTest extends TestCase { ]; } - /** - * @dataProvider dataTestThemes - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestThemes')] public function testEnableTheme(string $themeId, ?string $exception = null): void { $this->themesService ->expects($this->any()) @@ -109,9 +107,7 @@ class UserThemeControllerTest extends TestCase { $this->assertEquals($expected, $this->userThemeController->enableTheme($themeId)); } - /** - * @dataProvider dataTestThemes - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestThemes')] public function testDisableTheme(string $themeId, ?string $exception = null): void { $this->themesService ->expects($this->any()) diff --git a/apps/theming/tests/IconBuilderTest.php b/apps/theming/tests/IconBuilderTest.php index 5eb75e7e694..d881e4eb75c 100644 --- a/apps/theming/tests/IconBuilderTest.php +++ b/apps/theming/tests/IconBuilderTest.php @@ -63,9 +63,7 @@ class IconBuilderTest extends TestCase { ]; } - /** - * @dataProvider dataRenderAppIcon - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataRenderAppIcon')] public function testRenderAppIcon(string $app, string $color, string $file): void { $this->checkImagick(); $this->themingDefaults->expects($this->once()) @@ -89,9 +87,7 @@ class IconBuilderTest extends TestCase { // cloud be something like $expectedIcon->compareImages($icon, Imagick::METRIC_MEANABSOLUTEERROR)[1]) } - /** - * @dataProvider dataRenderAppIcon - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataRenderAppIcon')] public function testGetTouchIcon(string $app, string $color, string $file): void { $this->checkImagick(); $this->themingDefaults->expects($this->once()) @@ -116,9 +112,7 @@ class IconBuilderTest extends TestCase { // cloud be something like $expectedIcon->compareImages($icon, Imagick::METRIC_MEANABSOLUTEERROR)[1]) } - /** - * @dataProvider dataRenderAppIcon - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataRenderAppIcon')] public function testGetFavicon(string $app, string $color, string $file): void { $this->checkImagick(); $this->imageManager->expects($this->once()) diff --git a/apps/theming/tests/ImageManagerTest.php b/apps/theming/tests/ImageManagerTest.php index c9b930ca8c9..0c4d555cc00 100644 --- a/apps/theming/tests/ImageManagerTest.php +++ b/apps/theming/tests/ImageManagerTest.php @@ -221,7 +221,7 @@ class ImageManagerTest extends TestCase { $folder->expects($this->once()) ->method('getFile') ->with('filename') - ->will($this->throwException(new NotFoundException())); + ->willThrowException(new NotFoundException()); $image = $this->imageManager->getCachedImage('filename'); } @@ -313,9 +313,7 @@ class ImageManagerTest extends TestCase { ]; } - /** - * @dataProvider dataUpdateImage - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataUpdateImage')] public function testUpdateImage(string $key, string $tmpFile, bool $folderExists, bool $shouldConvert): void { $file = $this->createMock(ISimpleFile::class); $folder = $this->createMock(ISimpleFolder::class); diff --git a/apps/theming/tests/Service/ThemesServiceTest.php b/apps/theming/tests/Service/ThemesServiceTest.php index a2c3111fbd1..354ed1dec85 100644 --- a/apps/theming/tests/Service/ThemesServiceTest.php +++ b/apps/theming/tests/Service/ThemesServiceTest.php @@ -126,11 +126,11 @@ class ThemesServiceTest extends TestCase { } /** - * @dataProvider dataTestEnableTheme * * @param string[] $enabledThemes * @param string[] $expectedEnabled */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestEnableTheme')] public function testEnableTheme(string $toEnable, array $enabledThemes, array $expectedEnabled): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) @@ -159,11 +159,11 @@ class ThemesServiceTest extends TestCase { } /** - * @dataProvider dataTestDisableTheme * * @param string[] $enabledThemes * @param string[] $expectedEnabled */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestDisableTheme')] public function testDisableTheme(string $toDisable, array $enabledThemes, array $expectedEnabled): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) @@ -193,10 +193,9 @@ class ThemesServiceTest extends TestCase { } /** - * @dataProvider dataTestIsEnabled - * * @param string[] $enabledThemes */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsEnabled')] public function testIsEnabled(string $themeId, array $enabledThemes, bool $expected): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) @@ -270,11 +269,11 @@ class ThemesServiceTest extends TestCase { } /** - * @dataProvider dataTestSetEnabledThemes * * @param string[] $enabledThemes * @param string[] $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSetEnabledThemes')] public function testSetEnabledThemes(array $enabledThemes, array $expected): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) diff --git a/apps/theming/tests/ServicesTest.php b/apps/theming/tests/ServicesTest.php index c9b9a44be0b..3971c9b6698 100644 --- a/apps/theming/tests/ServicesTest.php +++ b/apps/theming/tests/ServicesTest.php @@ -60,9 +60,7 @@ class ServicesTest extends TestCase { ]; } - /** - * @dataProvider queryData - */ + #[\PHPUnit\Framework\Attributes\DataProvider('queryData')] public function testContainerQuery(string $service, ?string $expected = null): void { if ($expected === null) { $expected = $service; diff --git a/apps/theming/tests/Settings/PersonalTest.php b/apps/theming/tests/Settings/PersonalTest.php index e70ef623809..9216450ec9c 100644 --- a/apps/theming/tests/Settings/PersonalTest.php +++ b/apps/theming/tests/Settings/PersonalTest.php @@ -87,10 +87,9 @@ class PersonalTest extends TestCase { } /** - * @dataProvider dataTestGetForm - * * @param string[] $enabledThemes */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetForm')] public function testGetForm(string $enforcedTheme, array $themesState): void { $this->config->expects($this->once()) ->method('getSystemValueString') diff --git a/apps/theming/tests/Themes/AccessibleThemeTestCase.php b/apps/theming/tests/Themes/AccessibleThemeTestCase.php index f3dc2ed53b4..f516e1f5116 100644 --- a/apps/theming/tests/Themes/AccessibleThemeTestCase.php +++ b/apps/theming/tests/Themes/AccessibleThemeTestCase.php @@ -147,9 +147,7 @@ class AccessibleThemeTestCase extends TestCase { ]; } - /** - * @dataProvider dataAccessibilityPairs - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataAccessibilityPairs')] public function testAccessibilityOfVariables(array $mainColors, array $backgroundColors, float $minContrast): void { if (!isset($this->theme)) { $this->markTestSkipped('You need to setup $this->theme in your setUp function'); diff --git a/apps/theming/tests/Themes/DyslexiaFontTest.php b/apps/theming/tests/Themes/DyslexiaFontTest.php index ba27ab592f7..7d56fb4b1be 100644 --- a/apps/theming/tests/Themes/DyslexiaFontTest.php +++ b/apps/theming/tests/Themes/DyslexiaFontTest.php @@ -146,11 +146,10 @@ class DyslexiaFontTest extends TestCase { } /** - * @dataProvider dataTestGetCustomCss - * * Ensure the fonts are always loaded from the web root * despite having url rewriting enabled or not */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetCustomCss')] public function testGetCustomCss(string $webRoot, bool $prettyUrlsEnabled): void { \OC::$WEBROOT = $webRoot; $this->config->expects($this->any()) diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php index 2a0fee6cf16..1acd12f12fa 100644 --- a/apps/theming/tests/ThemingDefaultsTest.php +++ b/apps/theming/tests/ThemingDefaultsTest.php @@ -183,9 +183,7 @@ class ThemingDefaultsTest extends TestCase { ]; } - /** - * @dataProvider legalUrlProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('legalUrlProvider')] public function testGetImprintURL(string $imprintUrl): void { $this->config ->expects($this->once()) @@ -196,9 +194,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals($imprintUrl, $this->template->getImprintUrl()); } - /** - * @dataProvider legalUrlProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('legalUrlProvider')] public function testGetPrivacyURL(string $privacyUrl): void { $this->config ->expects($this->once()) @@ -346,9 +342,7 @@ class ThemingDefaultsTest extends TestCase { ]; } - /** - * @dataProvider invalidLegalUrlProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('invalidLegalUrlProvider')] public function testGetShortFooterInvalidImprint(string $invalidImprintUrl): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->config @@ -365,9 +359,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a> – Slogan', $this->template->getShortFooter()); } - /** - * @dataProvider invalidLegalUrlProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('invalidLegalUrlProvider')] public function testGetShortFooterInvalidPrivacy(string $invalidPrivacyUrl): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->config @@ -455,9 +447,7 @@ class ThemingDefaultsTest extends TestCase { ]; } - /** - * @dataProvider dataGetColorPrimary - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataGetColorPrimary')] public function testGetColorPrimary(bool $disableTheming, string $primaryColor, string $userPrimaryColor, string $expected): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) @@ -798,9 +788,7 @@ class ThemingDefaultsTest extends TestCase { ]; } - /** - * @dataProvider dataReplaceImagePath - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataReplaceImagePath')] public function testReplaceImagePath(string $app, string $image, string|bool $result = 'themingRoute?v=1234abcd'): void { $this->cache->expects($this->any()) ->method('get') diff --git a/apps/theming/tests/UtilTest.php b/apps/theming/tests/UtilTest.php index c0629e425e7..1e944027e32 100644 --- a/apps/theming/tests/UtilTest.php +++ b/apps/theming/tests/UtilTest.php @@ -48,9 +48,7 @@ class UtilTest extends TestCase { ]; } - /** - * @dataProvider dataColorContrast - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataColorContrast')] public function testColorContrast(string $color1, string $color2, int|float $contrast): void { $this->assertEqualsWithDelta($contrast, $this->util->colorContrast($color1, $color2), .001); } @@ -63,9 +61,7 @@ class UtilTest extends TestCase { ['#ffff00', true], ]; } - /** - * @dataProvider dataInvertTextColor - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataInvertTextColor')] public function testInvertTextColor(string $color, bool $expected): void { $invert = $this->util->invertTextColor($color); $this->assertEquals($expected, $invert); @@ -143,9 +139,7 @@ class UtilTest extends TestCase { $this->assertEquals($expected, $button); } - /** - * @dataProvider dataGetAppIcon - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataGetAppIcon')] public function testGetAppIcon(string $app, string $expected): void { $this->appData->expects($this->any()) ->method('getFolder') @@ -178,9 +172,7 @@ class UtilTest extends TestCase { $this->assertEquals($file, $icon); } - /** - * @dataProvider dataGetAppImage - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataGetAppImage')] public function testGetAppImage(string $app, string $image, string|bool $expected): void { $this->assertEquals($expected, $this->util->getAppImage($app, $image)); } @@ -226,9 +218,7 @@ class UtilTest extends TestCase { ['backgroundColor', false], ]; } - /** - * @dataProvider dataIsBackgroundThemed - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataIsBackgroundThemed')] public function testIsBackgroundThemed(string $backgroundMime, bool $expected): void { $this->config->expects($this->once()) ->method('getAppValue') |