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/theming/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/theming/tests')
19 files changed, 169 insertions, 169 deletions
diff --git a/apps/theming/tests/CapabilitiesTest.php b/apps/theming/tests/CapabilitiesTest.php index 5accb30b6a1..277dd5b6a7a 100644 --- a/apps/theming/tests/CapabilitiesTest.php +++ b/apps/theming/tests/CapabilitiesTest.php @@ -143,7 +143,7 @@ class CapabilitiesTest extends TestCase { * @param bool $backgroundThemed * @param string[] $expected */ - public function testGetCapabilities($name, $url, $slogan, $color, $textColor, $logo, $background, $backgroundColor, $backgroundTextColor, $baseUrl, $backgroundThemed, array $expected) { + public function testGetCapabilities($name, $url, $slogan, $color, $textColor, $logo, $background, $backgroundColor, $backgroundTextColor, $baseUrl, $backgroundThemed, array $expected): void { $this->config->expects($this->once()) ->method('getAppValue') ->willReturn($background); diff --git a/apps/theming/tests/Controller/IconControllerTest.php b/apps/theming/tests/Controller/IconControllerTest.php index e0159c03082..18fa7de1cc8 100644 --- a/apps/theming/tests/Controller/IconControllerTest.php +++ b/apps/theming/tests/Controller/IconControllerTest.php @@ -80,7 +80,7 @@ class IconControllerTest extends TestCase { return new SimpleFile($icon); } - public function testGetThemedIcon() { + public function testGetThemedIcon(): void { $file = $this->iconFileMock('icon-core-filetypes_folder.svg', 'filecontent'); $this->imageManager->expects($this->once()) ->method('getCachedImage') @@ -91,7 +91,7 @@ class IconControllerTest extends TestCase { $this->assertEquals($expected, $this->iconController->getThemedIcon('core', 'filetypes/folder.svg')); } - public function testGetFaviconDefault() { + public function testGetFaviconDefault(): void { if (!extension_loaded('imagick')) { $this->markTestSkipped('Imagemagick is required for dynamic icon generation.'); } @@ -123,7 +123,7 @@ class IconControllerTest extends TestCase { $this->assertEquals($expected, $this->iconController->getFavicon()); } - public function testGetFaviconFail() { + public function testGetFaviconFail(): void { $this->imageManager->expects($this->once()) ->method('getImage') ->with('favicon', false) @@ -141,7 +141,7 @@ class IconControllerTest extends TestCase { $this->assertEquals($expected, $this->iconController->getFavicon()); } - public function testGetTouchIconDefault() { + public function testGetTouchIconDefault(): void { if (!extension_loaded('imagick')) { $this->markTestSkipped('Imagemagick is required for dynamic icon generation.'); } @@ -173,7 +173,7 @@ class IconControllerTest extends TestCase { $this->assertEquals($expected, $this->iconController->getTouchIcon()); } - public function testGetTouchIconFail() { + public function testGetTouchIconFail(): void { $this->imageManager->expects($this->once()) ->method('getImage') ->with('favicon') diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php index f32f3c790d0..d69ceefa0e5 100644 --- a/apps/theming/tests/Controller/ThemingControllerTest.php +++ b/apps/theming/tests/Controller/ThemingControllerTest.php @@ -96,7 +96,7 @@ class ThemingControllerTest extends TestCase { * @param string $value * @param string $message */ - public function testUpdateStylesheetSuccess($setting, $value, $message) { + public function testUpdateStylesheetSuccess($setting, $value, $message): void { $this->themingDefaults ->expects($this->once()) ->method('set') @@ -147,7 +147,7 @@ class ThemingControllerTest extends TestCase { * @param string $value * @param string $message */ - public function testUpdateStylesheetError($setting, $value, $message) { + public function testUpdateStylesheetError($setting, $value, $message): void { $this->themingDefaults ->expects($this->never()) ->method('set') @@ -172,7 +172,7 @@ class ThemingControllerTest extends TestCase { $this->assertEquals($expected, $this->themingController->updateStylesheet($setting, $value)); } - public function testUpdateLogoNoData() { + public function testUpdateLogoNoData(): void { $this->request ->expects($this->once()) ->method('getParam') @@ -204,7 +204,7 @@ class ThemingControllerTest extends TestCase { $this->assertEquals($expected, $this->themingController->uploadImage()); } - public function testUploadInvalidUploadKey() { + public function testUploadInvalidUploadKey(): void { $this->request ->expects($this->once()) ->method('getParam') @@ -241,7 +241,7 @@ class ThemingControllerTest extends TestCase { * @test * @return void */ - public function testUploadSVGFaviconWithoutImagemagick() { + public function testUploadSVGFaviconWithoutImagemagick(): void { $this->imageManager ->method('shouldReplaceIcons') ->willReturn(false); @@ -286,7 +286,7 @@ class ThemingControllerTest extends TestCase { $this->assertEquals($expected, $this->themingController->uploadImage()); } - public function testUpdateLogoInvalidMimeType() { + public function testUpdateLogoInvalidMimeType(): void { $this->request ->expects($this->once()) ->method('getParam') @@ -339,7 +339,7 @@ class ThemingControllerTest extends TestCase { } /** @dataProvider dataUpdateImages */ - public function testUpdateLogoNormalLogoUpload($mimeType, $folderExists = true) { + public function testUpdateLogoNormalLogoUpload($mimeType, $folderExists = true): void { $tmpLogo = \OC::$server->getTempManager()->getTemporaryFolder() . '/logo.svg'; $destination = \OC::$server->getTempManager()->getTemporaryFolder(); @@ -391,7 +391,7 @@ class ThemingControllerTest extends TestCase { } /** @dataProvider dataUpdateImages */ - public function testUpdateLogoLoginScreenUpload($folderExists) { + public function testUpdateLogoLoginScreenUpload($folderExists): void { $tmpLogo = \OC::$server->getTempManager()->getTemporaryFolder() . 'logo.png'; touch($tmpLogo); @@ -439,7 +439,7 @@ class ThemingControllerTest extends TestCase { $this->assertEquals($expected, $this->themingController->uploadImage()); } - public function testUpdateLogoLoginScreenUploadWithInvalidImage() { + public function testUpdateLogoLoginScreenUploadWithInvalidImage(): void { $tmpLogo = \OC::$server->getTempManager()->getTemporaryFolder() . '/logo.svg'; touch($tmpLogo); @@ -498,7 +498,7 @@ class ThemingControllerTest extends TestCase { /** * @dataProvider dataPhpUploadErrors */ - public function testUpdateLogoLoginScreenUploadWithInvalidImageUpload($error, $expectedErrorMessage) { + public function testUpdateLogoLoginScreenUploadWithInvalidImageUpload($error, $expectedErrorMessage): void { $this->request ->expects($this->once()) ->method('getParam') @@ -537,7 +537,7 @@ class ThemingControllerTest extends TestCase { /** * @dataProvider dataPhpUploadErrors */ - public function testUpdateLogoUploadWithInvalidImageUpload($error, $expectedErrorMessage) { + public function testUpdateLogoUploadWithInvalidImageUpload($error, $expectedErrorMessage): void { $this->request ->expects($this->once()) ->method('getParam') @@ -573,7 +573,7 @@ class ThemingControllerTest extends TestCase { $this->assertEquals($expected, $this->themingController->uploadImage()); } - public function testUndo() { + public function testUndo(): void { $this->l10n ->expects($this->once()) ->method('t') @@ -606,7 +606,7 @@ class ThemingControllerTest extends TestCase { } /** @dataProvider dataUndoDelete */ - public function testUndoDelete($value, $filename) { + public function testUndoDelete($value, $filename): void { $this->l10n ->expects($this->once()) ->method('t') @@ -633,7 +633,7 @@ class ThemingControllerTest extends TestCase { - public function testGetLogoNotExistent() { + public function testGetLogoNotExistent(): void { $this->imageManager->method('getImage') ->with($this->equalTo('logo')) ->willThrowException(new NotFoundException()); @@ -642,7 +642,7 @@ class ThemingControllerTest extends TestCase { $this->assertEquals($expected, $this->themingController->getImage('logo')); } - public function testGetLogo() { + public function testGetLogo(): void { $file = $this->createMock(ISimpleFile::class); $file->method('getName')->willReturn('logo.svg'); $file->method('getMTime')->willReturn(42); @@ -666,7 +666,7 @@ class ThemingControllerTest extends TestCase { } - public function testGetLoginBackgroundNotExistent() { + public function testGetLoginBackgroundNotExistent(): void { $this->imageManager->method('getImage') ->with($this->equalTo('background')) ->willThrowException(new NotFoundException()); @@ -674,7 +674,7 @@ class ThemingControllerTest extends TestCase { $this->assertEquals($expected, $this->themingController->getImage('background')); } - public function testGetLoginBackground() { + public function testGetLoginBackground(): void { $file = $this->createMock(ISimpleFile::class); $file->method('getName')->willReturn('background.png'); $file->method('getMTime')->willReturn(42); @@ -698,7 +698,7 @@ class ThemingControllerTest extends TestCase { @$this->assertEquals($expected, $this->themingController->getImage('background')); } - public function testGetManifest() { + public function testGetManifest(): void { $this->config ->expects($this->once()) ->method('getAppValue') diff --git a/apps/theming/tests/Controller/UserThemeControllerTest.php b/apps/theming/tests/Controller/UserThemeControllerTest.php index 8c3ae7364cd..7d369463c0d 100644 --- a/apps/theming/tests/Controller/UserThemeControllerTest.php +++ b/apps/theming/tests/Controller/UserThemeControllerTest.php @@ -104,7 +104,7 @@ class UserThemeControllerTest extends TestCase { * @param string $themeId * @param string $exception */ - public function testEnableTheme($themeId, ?string $exception = null) { + public function testEnableTheme($themeId, ?string $exception = null): void { $this->themesService ->expects($this->any()) ->method('getThemes') @@ -124,7 +124,7 @@ class UserThemeControllerTest extends TestCase { * @param string $themeId * @param string $exception */ - public function testDisableTheme($themeId, ?string $exception = null) { + public function testDisableTheme($themeId, ?string $exception = null): void { $this->themesService ->expects($this->any()) ->method('getThemes') diff --git a/apps/theming/tests/IconBuilderTest.php b/apps/theming/tests/IconBuilderTest.php index 0d8b8c83923..942bcf399fa 100644 --- a/apps/theming/tests/IconBuilderTest.php +++ b/apps/theming/tests/IconBuilderTest.php @@ -74,7 +74,7 @@ class IconBuilderTest extends TestCase { * @param $color * @param $file */ - public function testRenderAppIcon($app, $color, $file) { + public function testRenderAppIcon($app, $color, $file): void { $this->checkImagick(); $this->themingDefaults->expects($this->once()) ->method('getColorPrimary') @@ -103,7 +103,7 @@ class IconBuilderTest extends TestCase { * @param $color * @param $file */ - public function testGetTouchIcon($app, $color, $file) { + public function testGetTouchIcon($app, $color, $file): void { $this->checkImagick(); $this->themingDefaults->expects($this->once()) ->method('getColorPrimary') @@ -133,7 +133,7 @@ class IconBuilderTest extends TestCase { * @param $color * @param $file */ - public function testGetFavicon($app, $color, $file) { + public function testGetFavicon($app, $color, $file): void { $this->checkImagick(); $this->imageManager->expects($this->once()) ->method('shouldReplaceIcons') @@ -162,7 +162,7 @@ class IconBuilderTest extends TestCase { // cloud be something like $expectedIcon->compareImages($icon, Imagick::METRIC_MEANABSOLUTEERROR)[1]) } - public function testGetFaviconNotFound() { + public function testGetFaviconNotFound(): void { $this->checkImagick(); $this->expectWarning(Warning::class); $util = $this->getMockBuilder(Util::class)->disableOriginalConstructor()->getMock(); @@ -176,7 +176,7 @@ class IconBuilderTest extends TestCase { $this->assertFalse($iconBuilder->getFavicon('noapp')); } - public function testGetTouchIconNotFound() { + public function testGetTouchIconNotFound(): void { $this->checkImagick(); $this->expectWarning(Warning::class); $util = $this->getMockBuilder(Util::class)->disableOriginalConstructor()->getMock(); @@ -187,7 +187,7 @@ class IconBuilderTest extends TestCase { $this->assertFalse($iconBuilder->getTouchIcon('noapp')); } - public function testColorSvgNotFound() { + public function testColorSvgNotFound(): void { $this->checkImagick(); $this->expectWarning(Warning::class); $util = $this->getMockBuilder(Util::class)->disableOriginalConstructor()->getMock(); diff --git a/apps/theming/tests/ImageManagerTest.php b/apps/theming/tests/ImageManagerTest.php index f3c2156be7e..54e4e2a70ee 100644 --- a/apps/theming/tests/ImageManagerTest.php +++ b/apps/theming/tests/ImageManagerTest.php @@ -117,7 +117,7 @@ class ImageManagerTest extends TestCase { } } - public function testGetImageUrl() { + public function testGetImageUrl(): void { $this->checkImagick(); $file = $this->createMock(ISimpleFile::class); $this->config->expects($this->exactly(2)) @@ -133,7 +133,7 @@ class ImageManagerTest extends TestCase { $this->assertEquals('url-to-image?v=0', $this->imageManager->getImageUrl('logo', false)); } - public function testGetImageUrlDefault() { + public function testGetImageUrlDefault(): void { $this->config->expects($this->exactly(2)) ->method('getAppValue') ->withConsecutive( @@ -148,7 +148,7 @@ class ImageManagerTest extends TestCase { $this->assertEquals('logo/logo.png?v=0', $this->imageManager->getImageUrl('logo')); } - public function testGetImageUrlAbsolute() { + public function testGetImageUrlAbsolute(): void { $this->checkImagick(); $file = $this->createMock(ISimpleFile::class); $this->config->expects($this->exactly(2)) @@ -164,7 +164,7 @@ class ImageManagerTest extends TestCase { $this->assertEquals('url-to-image-absolute?v=0', $this->imageManager->getImageUrlAbsolute('logo', false)); } - public function testGetImage() { + public function testGetImage(): void { $this->checkImagick(); $this->config->expects($this->once()) ->method('getAppValue')->with('theming', 'logoMime', false) @@ -175,7 +175,7 @@ class ImageManagerTest extends TestCase { } - public function testGetImageUnset() { + public function testGetImageUnset(): void { $this->expectException(\OCP\Files\NotFoundException::class); $this->config->expects($this->once()) @@ -184,7 +184,7 @@ class ImageManagerTest extends TestCase { $this->imageManager->getImage('logo'); } - public function testGetCacheFolder() { + public function testGetCacheFolder(): void { $folder = $this->createMock(ISimpleFolder::class); $this->config->expects($this->once()) ->method('getAppValue') @@ -196,7 +196,7 @@ class ImageManagerTest extends TestCase { ->willReturn($folder); $this->assertEquals($folder, $this->imageManager->getCacheFolder()); } - public function testGetCacheFolderCreate() { + public function testGetCacheFolderCreate(): void { $folder = $this->createMock(ISimpleFolder::class); $this->config->expects($this->exactly(2)) ->method('getAppValue') @@ -219,7 +219,7 @@ class ImageManagerTest extends TestCase { $this->assertEquals($folder, $this->imageManager->getCacheFolder()); } - public function testGetCachedImage() { + public function testGetCachedImage(): void { $expected = $this->createMock(ISimpleFile::class); $folder = $this->setupCacheFolder(); $folder->expects($this->once()) @@ -230,7 +230,7 @@ class ImageManagerTest extends TestCase { } - public function testGetCachedImageNotFound() { + public function testGetCachedImageNotFound(): void { $this->expectException(\OCP\Files\NotFoundException::class); $folder = $this->setupCacheFolder(); @@ -241,7 +241,7 @@ class ImageManagerTest extends TestCase { $image = $this->imageManager->getCachedImage('filename'); } - public function testSetCachedImage() { + public function testSetCachedImage(): void { $folder = $this->setupCacheFolder(); $file = $this->createMock(ISimpleFile::class); $folder->expects($this->once()) @@ -258,7 +258,7 @@ class ImageManagerTest extends TestCase { $this->assertEquals($file, $this->imageManager->setCachedImage('filename', 'filecontent')); } - public function testSetCachedImageCreate() { + public function testSetCachedImageCreate(): void { $folder = $this->setupCacheFolder(); $file = $this->createMock(ISimpleFile::class); $folder->expects($this->once()) @@ -288,7 +288,7 @@ class ImageManagerTest extends TestCase { return $folder; } - public function testCleanup() { + public function testCleanup(): void { $folders = [ $this->createMock(ISimpleFolder::class), $this->createMock(ISimpleFolder::class), @@ -332,7 +332,7 @@ class ImageManagerTest extends TestCase { /** * @dataProvider dataUpdateImage */ - public function testUpdateImage($key, $tmpFile, $folderExists, $shouldConvert) { + public function testUpdateImage($key, $tmpFile, $folderExists, $shouldConvert): void { $file = $this->createMock(ISimpleFile::class); $folder = $this->createMock(ISimpleFolder::class); $oldFile = $this->createMock(ISimpleFile::class); diff --git a/apps/theming/tests/Service/ThemesServiceTest.php b/apps/theming/tests/Service/ThemesServiceTest.php index 1644deea4c7..77371cfe34c 100644 --- a/apps/theming/tests/Service/ThemesServiceTest.php +++ b/apps/theming/tests/Service/ThemesServiceTest.php @@ -70,7 +70,7 @@ class ThemesServiceTest extends TestCase { parent::setUp(); } - public function testGetThemes() { + public function testGetThemes(): void { $expected = [ 'default', 'light', @@ -82,7 +82,7 @@ class ThemesServiceTest extends TestCase { $this->assertEquals($expected, array_keys($this->themesService->getThemes())); } - public function testGetThemesEnforced() { + public function testGetThemesEnforced(): void { $this->config->expects($this->once()) ->method('getSystemValueString') ->with('enforce_theme', '') @@ -98,7 +98,7 @@ class ThemesServiceTest extends TestCase { $this->assertEquals($expected, array_keys($this->themesService->getThemes())); } - public function testGetThemesEnforcedInvalid() { + public function testGetThemesEnforcedInvalid(): void { $this->config->expects($this->once()) ->method('getSystemValueString') ->with('enforce_theme', '') @@ -136,7 +136,7 @@ class ThemesServiceTest extends TestCase { * @param string[] $enabledThemes * @param string[] $expectedEnabled */ - public function testEnableTheme(string $toEnable, array $enabledThemes, array $expectedEnabled) { + public function testEnableTheme(string $toEnable, array $enabledThemes, array $expectedEnabled): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) ->method('getUser') @@ -170,7 +170,7 @@ class ThemesServiceTest extends TestCase { * @param string[] $enabledThemes * @param string[] $expectedEnabled */ - public function testDisableTheme(string $toDisable, array $enabledThemes, array $expectedEnabled) { + public function testDisableTheme(string $toDisable, array $enabledThemes, array $expectedEnabled): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) ->method('getUser') @@ -204,7 +204,7 @@ class ThemesServiceTest extends TestCase { * @param string $toEnable * @param string[] $enabledThemes */ - public function testIsEnabled(string $themeId, array $enabledThemes, $expected) { + public function testIsEnabled(string $themeId, array $enabledThemes, $expected): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) ->method('getUser') @@ -222,7 +222,7 @@ class ThemesServiceTest extends TestCase { $this->assertEquals($expected, $this->themesService->isEnabled($this->themes[$themeId])); } - public function testGetEnabledThemes() { + public function testGetEnabledThemes(): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) ->method('getUser') @@ -244,7 +244,7 @@ class ThemesServiceTest extends TestCase { $this->assertEquals([], $this->themesService->getEnabledThemes()); } - public function testGetEnabledThemesEnforced() { + public function testGetEnabledThemesEnforced(): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) ->method('getUser') @@ -282,7 +282,7 @@ class ThemesServiceTest extends TestCase { * @param string[] $enabledThemes * @param string[] $expected */ - public function testSetEnabledThemes(array $enabledThemes, array $expected) { + public function testSetEnabledThemes(array $enabledThemes, array $expected): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) ->method('getUser') diff --git a/apps/theming/tests/ServicesTest.php b/apps/theming/tests/ServicesTest.php index 2e404d6fd43..3223de0a489 100644 --- a/apps/theming/tests/ServicesTest.php +++ b/apps/theming/tests/ServicesTest.php @@ -64,7 +64,7 @@ class ServicesTest extends TestCase { * @param string $service * @param string $expected */ - public function testContainerQuery($service, $expected = null) { + public function testContainerQuery($service, $expected = null): void { if ($expected === null) { $expected = $service; } diff --git a/apps/theming/tests/Settings/AdminSectionTest.php b/apps/theming/tests/Settings/AdminSectionTest.php index 8916313e9a2..a73eca1cc5a 100644 --- a/apps/theming/tests/Settings/AdminSectionTest.php +++ b/apps/theming/tests/Settings/AdminSectionTest.php @@ -31,11 +31,11 @@ class AdminSectionTest extends TestCase { ); } - public function testGetID() { + public function testGetID(): void { $this->assertSame('theming', $this->section->getID()); } - public function testGetName() { + public function testGetName(): void { $this->l ->expects($this->once()) ->method('t') @@ -45,11 +45,11 @@ class AdminSectionTest extends TestCase { $this->assertSame('Theming', $this->section->getName()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(30, $this->section->getPriority()); } - public function testGetIcon() { + public function testGetIcon(): void { $this->url->expects($this->once()) ->method('imagePath') ->with('theming', 'app-dark.svg') diff --git a/apps/theming/tests/Settings/AdminTest.php b/apps/theming/tests/Settings/AdminTest.php index d74668f5e6f..189a91bae3a 100644 --- a/apps/theming/tests/Settings/AdminTest.php +++ b/apps/theming/tests/Settings/AdminTest.php @@ -49,7 +49,7 @@ class AdminTest extends TestCase { ); } - public function testGetFormNoErrors() { + public function testGetFormNoErrors(): void { $this->config ->expects($this->once()) ->method('getSystemValue') @@ -84,7 +84,7 @@ class AdminTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetFormWithErrors() { + public function testGetFormWithErrors(): void { $this->config ->expects($this->once()) ->method('getSystemValue') @@ -124,11 +124,11 @@ class AdminTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetSection() { + public function testGetSection(): void { $this->assertSame('theming', $this->admin->getSection()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(5, $this->admin->getPriority()); } } diff --git a/apps/theming/tests/Settings/PersonalTest.php b/apps/theming/tests/Settings/PersonalTest.php index 88c5e93d1c7..4630ef48c8a 100644 --- a/apps/theming/tests/Settings/PersonalTest.php +++ b/apps/theming/tests/Settings/PersonalTest.php @@ -91,7 +91,7 @@ class PersonalTest extends TestCase { * @param string $toEnable * @param string[] $enabledThemes */ - public function testGetForm(string $enforcedTheme, $themesState) { + public function testGetForm(string $enforcedTheme, $themesState): void { $this->config->expects($this->once()) ->method('getSystemValueString') ->with('enforce_theme', '') @@ -125,11 +125,11 @@ class PersonalTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetSection() { + public function testGetSection(): void { $this->assertSame('theming', $this->admin->getSection()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(40, $this->admin->getPriority()); } diff --git a/apps/theming/tests/Themes/AccessibleThemeTestCase.php b/apps/theming/tests/Themes/AccessibleThemeTestCase.php index 5f13e2259aa..a1327a04f0b 100644 --- a/apps/theming/tests/Themes/AccessibleThemeTestCase.php +++ b/apps/theming/tests/Themes/AccessibleThemeTestCase.php @@ -148,7 +148,7 @@ class AccessibleThemeTestCase extends TestCase { /** * @dataProvider dataAccessibilityPairs */ - public function testAccessibilityOfVariables($mainColors, $backgroundColors, $minContrast) { + public function testAccessibilityOfVariables($mainColors, $backgroundColors, $minContrast): void { if (!isset($this->theme)) { $this->markTestSkipped('You need to setup $this->theme in your setUp function'); } elseif (!isset($this->util)) { diff --git a/apps/theming/tests/Themes/DarkHighContrastThemeTest.php b/apps/theming/tests/Themes/DarkHighContrastThemeTest.php index 30bbc5f110d..63fb2bf414d 100644 --- a/apps/theming/tests/Themes/DarkHighContrastThemeTest.php +++ b/apps/theming/tests/Themes/DarkHighContrastThemeTest.php @@ -108,27 +108,27 @@ class DarkHighContrastThemeTest extends AccessibleThemeTestCase { } - public function testGetId() { + public function testGetId(): void { $this->assertEquals('dark-highcontrast', $this->theme->getId()); } - public function testGetType() { + public function testGetType(): void { $this->assertEquals(ITheme::TYPE_THEME, $this->theme->getType()); } - public function testGetTitle() { + public function testGetTitle(): void { $this->assertEquals('Dark theme with high contrast mode', $this->theme->getTitle()); } - public function testGetEnableLabel() { + public function testGetEnableLabel(): void { $this->assertEquals('Enable dark high contrast mode', $this->theme->getEnableLabel()); } - public function testGetDescription() { + public function testGetDescription(): void { $this->assertEquals('Similar to the high contrast mode, but with dark colours.', $this->theme->getDescription()); } - public function testGetMediaQuery() { + public function testGetMediaQuery(): void { $this->assertEquals('(prefers-color-scheme: dark) and (prefers-contrast: more)', $this->theme->getMediaQuery()); } } diff --git a/apps/theming/tests/Themes/DarkThemeTest.php b/apps/theming/tests/Themes/DarkThemeTest.php index 16a289053ae..f53028d3a63 100644 --- a/apps/theming/tests/Themes/DarkThemeTest.php +++ b/apps/theming/tests/Themes/DarkThemeTest.php @@ -105,31 +105,31 @@ class DarkThemeTest extends AccessibleThemeTestCase { } - public function testGetId() { + public function testGetId(): void { $this->assertEquals('dark', $this->theme->getId()); } - public function testGetType() { + public function testGetType(): void { $this->assertEquals(ITheme::TYPE_THEME, $this->theme->getType()); } - public function testGetTitle() { + public function testGetTitle(): void { $this->assertEquals('Dark theme', $this->theme->getTitle()); } - public function testGetEnableLabel() { + public function testGetEnableLabel(): void { $this->assertEquals('Enable dark theme', $this->theme->getEnableLabel()); } - public function testGetDescription() { + public function testGetDescription(): void { $this->assertEquals('A dark theme to ease your eyes by reducing the overall luminosity and brightness.', $this->theme->getDescription()); } - public function testGetMediaQuery() { + public function testGetMediaQuery(): void { $this->assertEquals('(prefers-color-scheme: dark)', $this->theme->getMediaQuery()); } - public function testGetCustomCss() { + public function testGetCustomCss(): void { $this->assertEquals('', $this->theme->getCustomCss()); } } diff --git a/apps/theming/tests/Themes/DefaultThemeTest.php b/apps/theming/tests/Themes/DefaultThemeTest.php index d11237e774c..db6a5bf1cfc 100644 --- a/apps/theming/tests/Themes/DefaultThemeTest.php +++ b/apps/theming/tests/Themes/DefaultThemeTest.php @@ -109,31 +109,31 @@ class DefaultThemeTest extends AccessibleThemeTestCase { } - public function testGetId() { + public function testGetId(): void { $this->assertEquals('default', $this->theme->getId()); } - public function testGetType() { + public function testGetType(): void { $this->assertEquals(ITheme::TYPE_THEME, $this->theme->getType()); } - public function testGetTitle() { + public function testGetTitle(): void { $this->assertEquals('System default theme', $this->theme->getTitle()); } - public function testGetEnableLabel() { + public function testGetEnableLabel(): void { $this->assertEquals('Enable the system default', $this->theme->getEnableLabel()); } - public function testGetDescription() { + public function testGetDescription(): void { $this->assertEquals('Using the default system appearance.', $this->theme->getDescription()); } - public function testGetMediaQuery() { + public function testGetMediaQuery(): void { $this->assertEquals('', $this->theme->getMediaQuery()); } - public function testGetCustomCss() { + public function testGetCustomCss(): void { $this->assertEquals('', $this->theme->getCustomCss()); } @@ -141,7 +141,7 @@ class DefaultThemeTest extends AccessibleThemeTestCase { * Ensure parity between the default theme and the static generated file * @see ThemingController.php:313 */ - public function testThemindDisabledFallbackCss() { + public function testThemindDisabledFallbackCss(): void { // Generate variables $variables = ''; foreach ($this->theme->getCSSVariables() as $variable => $value) { diff --git a/apps/theming/tests/Themes/DyslexiaFontTest.php b/apps/theming/tests/Themes/DyslexiaFontTest.php index 99b6f8cfc8e..53505f4bd03 100644 --- a/apps/theming/tests/Themes/DyslexiaFontTest.php +++ b/apps/theming/tests/Themes/DyslexiaFontTest.php @@ -110,31 +110,31 @@ class DyslexiaFontTest extends TestCase { } - public function testGetId() { + public function testGetId(): void { $this->assertEquals('opendyslexic', $this->dyslexiaFont->getId()); } - public function testGetType() { + public function testGetType(): void { $this->assertEquals(ITheme::TYPE_FONT, $this->dyslexiaFont->getType()); } - public function testGetTitle() { + public function testGetTitle(): void { $this->assertNotEmpty($this->dyslexiaFont->getTitle()); } - public function testGetEnableLabel() { + public function testGetEnableLabel(): void { $this->assertNotEmpty($this->dyslexiaFont->getEnableLabel()); } - public function testGetDescription() { + public function testGetDescription(): void { $this->assertNotEmpty($this->dyslexiaFont->getDescription()); } - public function testGetMediaQuery() { + public function testGetMediaQuery(): void { $this->assertEquals('', $this->dyslexiaFont->getMediaQuery()); } - public function testGetCSSVariables() { + public function testGetCSSVariables(): void { $this->assertStringStartsWith('OpenDyslexic', $this->dyslexiaFont->getCSSVariables()['--font-face']); } @@ -156,7 +156,7 @@ class DyslexiaFontTest extends TestCase { * @param string $webRoot * @param bool $prettyUrlsEnabled */ - public function testGetCustomCss($webRoot, $prettyUrlsEnabled) { + public function testGetCustomCss($webRoot, $prettyUrlsEnabled): void { \OC::$WEBROOT = $webRoot; $this->config->expects($this->any()) ->method('getSystemValue') diff --git a/apps/theming/tests/Themes/HighContrastThemeTest.php b/apps/theming/tests/Themes/HighContrastThemeTest.php index 47c4b3bb374..603bf08a0ee 100644 --- a/apps/theming/tests/Themes/HighContrastThemeTest.php +++ b/apps/theming/tests/Themes/HighContrastThemeTest.php @@ -108,27 +108,27 @@ class HighContrastThemeTest extends AccessibleThemeTestCase { } - public function testGetId() { + public function testGetId(): void { $this->assertEquals('light-highcontrast', $this->theme->getId()); } - public function testGetType() { + public function testGetType(): void { $this->assertEquals(ITheme::TYPE_THEME, $this->theme->getType()); } - public function testGetTitle() { + public function testGetTitle(): void { $this->assertEquals('High contrast mode', $this->theme->getTitle()); } - public function testGetEnableLabel() { + public function testGetEnableLabel(): void { $this->assertEquals('Enable high contrast mode', $this->theme->getEnableLabel()); } - public function testGetDescription() { + public function testGetDescription(): void { $this->assertEquals('A high contrast mode to ease your navigation. Visual quality will be reduced but clarity will be increased.', $this->theme->getDescription()); } - public function testGetMediaQuery() { + public function testGetMediaQuery(): void { $this->assertEquals('(prefers-contrast: more)', $this->theme->getMediaQuery()); } } diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php index 8edbcbc53c1..d8f169e7f3d 100644 --- a/apps/theming/tests/ThemingDefaultsTest.php +++ b/apps/theming/tests/ThemingDefaultsTest.php @@ -85,7 +85,7 @@ class ThemingDefaultsTest extends TestCase { ); } - public function testGetNameWithDefault() { + public function testGetNameWithDefault(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -95,7 +95,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('Nextcloud', $this->template->getName()); } - public function testGetNameWithCustom() { + public function testGetNameWithCustom(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -105,7 +105,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('MyCustomCloud', $this->template->getName()); } - public function testGetHTMLNameWithDefault() { + public function testGetHTMLNameWithDefault(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -115,7 +115,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('Nextcloud', $this->template->getHTMLName()); } - public function testGetHTMLNameWithCustom() { + public function testGetHTMLNameWithCustom(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -125,7 +125,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('MyCustomCloud', $this->template->getHTMLName()); } - public function testGetTitleWithDefault() { + public function testGetTitleWithDefault(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -135,7 +135,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('Nextcloud', $this->template->getTitle()); } - public function testGetTitleWithCustom() { + public function testGetTitleWithCustom(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -146,7 +146,7 @@ class ThemingDefaultsTest extends TestCase { } - public function testGetEntityWithDefault() { + public function testGetEntityWithDefault(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -156,7 +156,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('Nextcloud', $this->template->getEntity()); } - public function testGetEntityWithCustom() { + public function testGetEntityWithCustom(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -166,7 +166,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('MyCustomCloud', $this->template->getEntity()); } - public function testGetBaseUrlWithDefault() { + public function testGetBaseUrlWithDefault(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -176,7 +176,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals($this->defaults->getBaseUrl(), $this->template->getBaseUrl()); } - public function testGetBaseUrlWithCustom() { + public function testGetBaseUrlWithCustom(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -197,7 +197,7 @@ class ThemingDefaultsTest extends TestCase { * @param $imprintUrl * @dataProvider legalUrlProvider */ - public function testGetImprintURL($imprintUrl) { + public function testGetImprintURL($imprintUrl): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -211,7 +211,7 @@ class ThemingDefaultsTest extends TestCase { * @param $privacyUrl * @dataProvider legalUrlProvider */ - public function testGetPrivacyURL($privacyUrl) { + public function testGetPrivacyURL($privacyUrl): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -221,7 +221,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals($privacyUrl, $this->template->getPrivacyUrl()); } - public function testGetSloganWithDefault() { + public function testGetSloganWithDefault(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -231,7 +231,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals($this->defaults->getSlogan(), $this->template->getSlogan()); } - public function testGetSloganWithCustom() { + public function testGetSloganWithCustom(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -241,7 +241,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('My custom Slogan', $this->template->getSlogan()); } - public function testGetShortFooter() { + public function testGetShortFooter(): void { $this->config ->expects($this->exactly(5)) ->method('getAppValue') @@ -256,7 +256,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a> – Slogan', $this->template->getShortFooter()); } - public function testGetShortFooterEmptyUrl() { + public function testGetShortFooterEmptyUrl(): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->config ->expects($this->exactly(5)) @@ -272,7 +272,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('<span class="entity-name">Name</span> – Slogan', $this->template->getShortFooter()); } - public function testGetShortFooterEmptySlogan() { + public function testGetShortFooterEmptySlogan(): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->config ->expects($this->exactly(5)) @@ -288,7 +288,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a>', $this->template->getShortFooter()); } - public function testGetShortFooterImprint() { + public function testGetShortFooterImprint(): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->config ->expects($this->exactly(5)) @@ -309,7 +309,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a> – Slogan<br/><span class="footer__legal-links"><a href="https://example.com/imprint" class="legal" target="_blank" rel="noreferrer noopener">Legal notice</a></span>', $this->template->getShortFooter()); } - public function testGetShortFooterPrivacy() { + public function testGetShortFooterPrivacy(): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->config ->expects($this->exactly(5)) @@ -330,7 +330,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a> – Slogan<br/><span class="footer__legal-links"><a href="https://example.com/privacy" class="legal" target="_blank" rel="noreferrer noopener">Privacy policy</a></span>', $this->template->getShortFooter()); } - public function testGetShortFooterAllLegalLinks() { + public function testGetShortFooterAllLegalLinks(): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->config ->expects($this->exactly(5)) @@ -362,7 +362,7 @@ class ThemingDefaultsTest extends TestCase { * @param $invalidImprintUrl * @dataProvider invalidLegalUrlProvider */ - public function testGetShortFooterInvalidImprint($invalidImprintUrl) { + public function testGetShortFooterInvalidImprint($invalidImprintUrl): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->config ->expects($this->exactly(5)) @@ -382,7 +382,7 @@ class ThemingDefaultsTest extends TestCase { * @param $invalidPrivacyUrl * @dataProvider invalidLegalUrlProvider */ - public function testGetShortFooterInvalidPrivacy($invalidPrivacyUrl) { + public function testGetShortFooterInvalidPrivacy($invalidPrivacyUrl): void { $this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]); $this->config ->expects($this->exactly(5)) @@ -398,7 +398,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a> – Slogan', $this->template->getShortFooter()); } - public function testGetColorPrimaryWithDefault() { + public function testGetColorPrimaryWithDefault(): void { $this->appConfig ->expects(self::once()) ->method('getValueBool') @@ -413,7 +413,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals($this->defaults->getColorPrimary(), $this->template->getColorPrimary()); } - public function testGetColorPrimaryWithCustom() { + public function testGetColorPrimaryWithCustom(): void { $this->appConfig ->expects(self::once()) ->method('getValueBool') @@ -472,7 +472,7 @@ class ThemingDefaultsTest extends TestCase { /** * @dataProvider dataGetColorPrimary */ - public function testGetColorPrimary(bool $disableTheming, string $primaryColor, string $userPrimaryColor, string $expected) { + public function testGetColorPrimary(bool $disableTheming, string $primaryColor, string $userPrimaryColor, string $expected): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->any()) ->method('getUser') @@ -499,7 +499,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals($expected, $this->template->getColorPrimary()); } - public function testSet() { + public function testSet(): void { $this->config ->expects($this->exactly(2)) ->method('setAppValue') @@ -527,7 +527,7 @@ class ThemingDefaultsTest extends TestCase { $this->template->set('MySetting', 'MyValue'); } - public function testUndoName() { + public function testUndoName(): void { $this->config ->expects($this->once()) ->method('deleteAppValue') @@ -550,7 +550,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertSame('Nextcloud', $this->template->undo('name')); } - public function testUndoBaseUrl() { + public function testUndoBaseUrl(): void { $this->config ->expects($this->once()) ->method('deleteAppValue') @@ -573,7 +573,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertSame($this->defaults->getBaseUrl(), $this->template->undo('url')); } - public function testUndoSlogan() { + public function testUndoSlogan(): void { $this->config ->expects($this->once()) ->method('deleteAppValue') @@ -596,7 +596,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertSame($this->defaults->getSlogan(), $this->template->undo('slogan')); } - public function testUndoPrimaryColor() { + public function testUndoPrimaryColor(): void { $this->config ->expects($this->once()) ->method('deleteAppValue') @@ -614,7 +614,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertSame($this->defaults->getColorPrimary(), $this->template->undo('primary_color')); } - public function testUndoDefaultAction() { + public function testUndoDefaultAction(): void { $this->config ->expects($this->once()) ->method('deleteAppValue') @@ -632,7 +632,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertSame('', $this->template->undo('defaultitem')); } - public function testGetBackground() { + public function testGetBackground(): void { $this->imageManager ->expects($this->once()) ->method('getImageUrl') @@ -663,15 +663,15 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('core-logo?v=0', $this->template->getLogo($useSvg)); } - public function testGetLogoDefaultWithSvg() { + public function testGetLogoDefaultWithSvg(): void { $this->getLogoHelper('logo/logo.svg', true); } - public function testGetLogoDefaultWithoutSvg() { + public function testGetLogoDefaultWithoutSvg(): void { $this->getLogoHelper('logo/logo.png', false); } - public function testGetLogoCustom() { + public function testGetLogoCustom(): void { $this->config ->expects($this->exactly(2)) ->method('getAppValue') @@ -689,7 +689,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('custom-logo' . '?v=0', $this->template->getLogo()); } - public function testGetScssVariablesCached() { + public function testGetScssVariablesCached(): void { $this->config->expects($this->any())->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('1'); $this->cacheFactory->expects($this->once()) ->method('createDistributed') @@ -699,7 +699,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals(['foo' => 'bar'], $this->template->getScssVariables()); } - public function testGetScssVariables() { + public function testGetScssVariables(): void { $this->config ->expects($this->any()) ->method('getAppValue') @@ -754,7 +754,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals($expected, $this->template->getScssVariables()); } - public function testGetDefaultAndroidURL() { + public function testGetDefaultAndroidURL(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -764,7 +764,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('https://play.google.com/store/apps/details?id=com.nextcloud.client', $this->template->getAndroidClientUrl()); } - public function testGetCustomAndroidURL() { + public function testGetCustomAndroidURL(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -774,7 +774,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('https://play.google.com/store/apps/details?id=com.mycloud.client', $this->template->getAndroidClientUrl()); } - public function testGetDefaultiOSURL() { + public function testGetDefaultiOSURL(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -784,7 +784,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('https://geo.itunes.apple.com/us/app/nextcloud/id1125420102?mt=8', $this->template->getiOSClientUrl()); } - public function testGetCustomiOSURL() { + public function testGetCustomiOSURL(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -794,7 +794,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('https://geo.itunes.apple.com/us/app/nextcloud/id1234567890?mt=8', $this->template->getiOSClientUrl()); } - public function testGetDefaultiTunesAppId() { + public function testGetDefaultiTunesAppId(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -804,7 +804,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('1125420102', $this->template->getiTunesAppId()); } - public function testGetCustomiTunesAppId() { + public function testGetCustomiTunesAppId(): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -824,7 +824,7 @@ class ThemingDefaultsTest extends TestCase { } /** @dataProvider dataReplaceImagePath */ - public function testReplaceImagePath($app, $image, $result = 'themingRoute?v=1234abcd') { + public function testReplaceImagePath($app, $image, $result = 'themingRoute?v=1234abcd'): void { $this->cache->expects($this->any()) ->method('get') ->with('shouldReplaceIcons') diff --git a/apps/theming/tests/UtilTest.php b/apps/theming/tests/UtilTest.php index 474daab6030..ba160684b7a 100644 --- a/apps/theming/tests/UtilTest.php +++ b/apps/theming/tests/UtilTest.php @@ -47,7 +47,7 @@ class UtilTest extends TestCase { /** * @dataProvider dataColorContrast */ - public function testColorContrast(string $color1, string $color2, $contrast) { + public function testColorContrast(string $color1, string $color2, $contrast): void { $this->assertEqualsWithDelta($contrast, $this->util->colorContrast($color1, $color2), .001); } @@ -62,78 +62,78 @@ class UtilTest extends TestCase { /** * @dataProvider dataInvertTextColor */ - public function testInvertTextColor($color, $expected) { + public function testInvertTextColor($color, $expected): void { $invert = $this->util->invertTextColor($color); $this->assertEquals($expected, $invert); } - public function testCalculateLuminanceLight() { + public function testCalculateLuminanceLight(): void { $luminance = $this->util->calculateLuminance('#ffffff'); $this->assertEquals(1, $luminance); } - public function testCalculateLuminanceDark() { + public function testCalculateLuminanceDark(): void { $luminance = $this->util->calculateLuminance('#000000'); $this->assertEquals(0, $luminance); } - public function testCalculateLuminanceLightShorthand() { + public function testCalculateLuminanceLightShorthand(): void { $luminance = $this->util->calculateLuminance('#fff'); $this->assertEquals(1, $luminance); } - public function testCalculateLuminanceDarkShorthand() { + public function testCalculateLuminanceDarkShorthand(): void { $luminance = $this->util->calculateLuminance('#000'); $this->assertEquals(0, $luminance); } - public function testInvertTextColorInvalid() { + public function testInvertTextColorInvalid(): void { $this->expectException(\Exception::class); $this->util->invertTextColor('aaabbbcccddd123'); } - public function testInvertTextColorEmpty() { + public function testInvertTextColorEmpty(): void { $this->expectException(\Exception::class); $this->util->invertTextColor(''); } - public function testElementColorDefaultBlack() { + public function testElementColorDefaultBlack(): void { $elementColor = $this->util->elementColor('#000000'); $this->assertEquals('#4d4d4d', $elementColor); } - public function testElementColorDefaultWhite() { + public function testElementColorDefaultWhite(): void { $elementColor = $this->util->elementColor('#ffffff'); $this->assertEquals('#b3b3b3', $elementColor); } - public function testElementColorBlackOnDarkBackground() { + public function testElementColorBlackOnDarkBackground(): void { $elementColor = $this->util->elementColor('#000000', false); $this->assertEquals('#4d4d4d', $elementColor); } - public function testElementColorBlackOnBrightBackground() { + public function testElementColorBlackOnBrightBackground(): void { $elementColor = $this->util->elementColor('#000000', true); $this->assertEquals('#000000', $elementColor); } - public function testElementColorWhiteOnBrightBackground() { + public function testElementColorWhiteOnBrightBackground(): void { $elementColor = $this->util->elementColor('#ffffff', true); $this->assertEquals('#b3b3b3', $elementColor); } - public function testElementColorWhiteOnDarkBackground() { + public function testElementColorWhiteOnDarkBackground(): void { $elementColor = $this->util->elementColor('#ffffff', false); $this->assertEquals('#ffffff', $elementColor); } - public function testGenerateRadioButtonWhite() { + public function testGenerateRadioButtonWhite(): void { $button = $this->util->generateRadioButton('#ffffff'); $expected = 'PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYiIHdpZHRoPSIxNiI+PHBhdGggZD0iTTggMWE3IDcgMCAwIDAtNyA3IDcgNyAwIDAgMCA3IDcgNyA3IDAgMCAwIDctNyA3IDcgMCAwIDAtNy03em0wIDFhNiA2IDAgMCAxIDYgNiA2IDYgMCAwIDEtNiA2IDYgNiAwIDAgMS02LTYgNiA2IDAgMCAxIDYtNnptMCAyYTQgNCAwIDEgMCAwIDggNCA0IDAgMCAwIDAtOHoiIGZpbGw9IiNmZmZmZmYiLz48L3N2Zz4='; $this->assertEquals($expected, $button); } - public function testGenerateRadioButtonBlack() { + public function testGenerateRadioButtonBlack(): void { $button = $this->util->generateRadioButton('#000000'); $expected = 'PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYiIHdpZHRoPSIxNiI+PHBhdGggZD0iTTggMWE3IDcgMCAwIDAtNyA3IDcgNyAwIDAgMCA3IDcgNyA3IDAgMCAwIDctNyA3IDcgMCAwIDAtNy03em0wIDFhNiA2IDAgMCAxIDYgNiA2IDYgMCAwIDEtNiA2IDYgNiAwIDAgMS02LTYgNiA2IDAgMCAxIDYtNnptMCAyYTQgNCAwIDEgMCAwIDggNCA0IDAgMCAwIDAtOHoiIGZpbGw9IiMwMDAwMDAiLz48L3N2Zz4='; $this->assertEquals($expected, $button); @@ -142,7 +142,7 @@ class UtilTest extends TestCase { /** * @dataProvider dataGetAppIcon */ - public function testGetAppIcon($app, $expected) { + public function testGetAppIcon($app, $expected): void { $this->appData->expects($this->any()) ->method('getFolder') ->with('global/images') @@ -159,7 +159,7 @@ class UtilTest extends TestCase { ]; } - public function testGetAppIconThemed() { + public function testGetAppIconThemed(): void { $file = $this->createMock(ISimpleFile::class); $folder = $this->createMock(ISimpleFolder::class); $folder->expects($this->once()) @@ -177,7 +177,7 @@ class UtilTest extends TestCase { /** * @dataProvider dataGetAppImage */ - public function testGetAppImage($app, $image, $expected) { + public function testGetAppImage($app, $image, $expected): void { $this->assertEquals($expected, $this->util->getAppImage($app, $image)); } @@ -190,14 +190,14 @@ class UtilTest extends TestCase { ]; } - public function testColorizeSvg() { + public function testColorizeSvg(): void { $input = '#0082c9 #0082C9 #000000 #FFFFFF'; $expected = '#AAAAAA #AAAAAA #000000 #FFFFFF'; $result = $this->util->colorizeSvg($input, '#AAAAAA'); $this->assertEquals($expected, $result); } - public function testIsAlreadyThemedFalse() { + public function testIsAlreadyThemedFalse(): void { $this->config->expects($this->once()) ->method('getSystemValue') ->with('theme', '') @@ -206,7 +206,7 @@ class UtilTest extends TestCase { $this->assertFalse($actual); } - public function testIsAlreadyThemedTrue() { + public function testIsAlreadyThemedTrue(): void { $this->config->expects($this->once()) ->method('getSystemValue') ->with('theme', '') @@ -225,7 +225,7 @@ class UtilTest extends TestCase { /** * @dataProvider dataIsBackgroundThemed */ - public function testIsBackgroundThemed($backgroundMime, $expected) { + public function testIsBackgroundThemed($backgroundMime, $expected): void { $this->config->expects($this->once()) ->method('getAppValue') ->with('theming', 'backgroundMime', '') |