aboutsummaryrefslogtreecommitdiffstats
path: root/apps/theming/tests/UtilTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/theming/tests/UtilTest.php')
-rw-r--r--apps/theming/tests/UtilTest.php42
1 files changed, 17 insertions, 25 deletions
diff --git a/apps/theming/tests/UtilTest.php b/apps/theming/tests/UtilTest.php
index f664a46733d..1e944027e32 100644
--- a/apps/theming/tests/UtilTest.php
+++ b/apps/theming/tests/UtilTest.php
@@ -1,4 +1,6 @@
<?php
+
+declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@@ -35,7 +37,7 @@ class UtilTest extends TestCase {
$this->util = new Util($this->createMock(ServerVersion::class), $this->config, $this->appManager, $this->appData, $this->imageManager);
}
- public function dataColorContrast() {
+ public static function dataColorContrast(): array {
return [
['#ffffff', '#FFFFFF', 1],
['#000000', '#000000', 1],
@@ -46,14 +48,12 @@ class UtilTest extends TestCase {
];
}
- /**
- * @dataProvider dataColorContrast
- */
- public function testColorContrast(string $color1, string $color2, $contrast): void {
+ #[\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);
}
- public function dataInvertTextColor() {
+ public static function dataInvertTextColor(): array {
return [
['#ffffff', true],
['#000000', false],
@@ -61,10 +61,8 @@ class UtilTest extends TestCase {
['#ffff00', true],
];
}
- /**
- * @dataProvider dataInvertTextColor
- */
- public function testInvertTextColor($color, $expected): void {
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataInvertTextColor')]
+ public function testInvertTextColor(string $color, bool $expected): void {
$invert = $this->util->invertTextColor($color);
$this->assertEquals($expected, $invert);
}
@@ -141,10 +139,8 @@ class UtilTest extends TestCase {
$this->assertEquals($expected, $button);
}
- /**
- * @dataProvider dataGetAppIcon
- */
- public function testGetAppIcon($app, $expected): void {
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetAppIcon')]
+ public function testGetAppIcon(string $app, string $expected): void {
$this->appData->expects($this->any())
->method('getFolder')
->with('global/images')
@@ -153,7 +149,7 @@ class UtilTest extends TestCase {
$this->assertEquals($expected, $icon);
}
- public function dataGetAppIcon() {
+ public static function dataGetAppIcon(): array {
return [
['user_ldap', Server::get(IAppManager::class)->getAppPath('user_ldap') . '/img/app.svg'],
['noapplikethis', \OC::$SERVERROOT . '/core/img/logo/logo.svg'],
@@ -176,14 +172,12 @@ class UtilTest extends TestCase {
$this->assertEquals($file, $icon);
}
- /**
- * @dataProvider dataGetAppImage
- */
- public function testGetAppImage($app, $image, $expected): void {
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetAppImage')]
+ public function testGetAppImage(string $app, string $image, string|bool $expected): void {
$this->assertEquals($expected, $this->util->getAppImage($app, $image));
}
- public function dataGetAppImage() {
+ public static function dataGetAppImage(): array {
return [
['core', 'logo/logo.svg', \OC::$SERVERROOT . '/core/img/logo/logo.svg'],
['files', 'folder', \OC::$SERVERROOT . '/apps/files/img/folder.svg'],
@@ -217,17 +211,15 @@ class UtilTest extends TestCase {
$this->assertTrue($actual);
}
- public function dataIsBackgroundThemed() {
+ public static function dataIsBackgroundThemed(): array {
return [
['', false],
['png', true],
['backgroundColor', false],
];
}
- /**
- * @dataProvider dataIsBackgroundThemed
- */
- public function testIsBackgroundThemed($backgroundMime, $expected): void {
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataIsBackgroundThemed')]
+ public function testIsBackgroundThemed(string $backgroundMime, bool $expected): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('theming', 'backgroundMime', '')