aboutsummaryrefslogtreecommitdiffstats
path: root/apps/theming
diff options
context:
space:
mode:
Diffstat (limited to 'apps/theming')
-rw-r--r--apps/theming/lib/Util.php21
-rw-r--r--apps/theming/tests/CapabilitiesTest.php3
-rw-r--r--apps/theming/tests/IconBuilderTest.php3
-rw-r--r--apps/theming/tests/Themes/DarkHighContrastThemeTest.php2
-rw-r--r--apps/theming/tests/Themes/DarkThemeTest.php2
-rw-r--r--apps/theming/tests/Themes/DefaultThemeTest.php2
-rw-r--r--apps/theming/tests/Themes/DyslexiaFontTest.php2
-rw-r--r--apps/theming/tests/Themes/HighContrastThemeTest.php2
-rw-r--r--apps/theming/tests/UtilTest.php3
9 files changed, 25 insertions, 15 deletions
diff --git a/apps/theming/lib/Util.php b/apps/theming/lib/Util.php
index 839ef1d0b46..fbb465505ac 100644
--- a/apps/theming/lib/Util.php
+++ b/apps/theming/lib/Util.php
@@ -13,19 +13,16 @@ use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\IConfig;
use OCP\IUserSession;
+use OCP\ServerVersion;
class Util {
-
- private IConfig $config;
- private IAppManager $appManager;
- private IAppData $appData;
- private ImageManager $imageManager;
-
- public function __construct(IConfig $config, IAppManager $appManager, IAppData $appData, ImageManager $imageManager) {
- $this->config = $config;
- $this->appManager = $appManager;
- $this->appData = $appData;
- $this->imageManager = $imageManager;
+ public function __construct(
+ private ServerVersion $serverVersion,
+ private IConfig $config,
+ private IAppManager $appManager,
+ private IAppData $appData,
+ private ImageManager $imageManager,
+ ) {
}
/**
@@ -311,7 +308,7 @@ class Util {
if (!is_null($user)) {
$userId = $user->getUID();
}
- $serverVersion = \OC_Util::getVersionString();
+ $serverVersion = $this->serverVersion->getVersionString();
$themingAppVersion = $this->appManager->getAppVersion('theming');
$userCacheBuster = '';
if ($userId) {
diff --git a/apps/theming/tests/CapabilitiesTest.php b/apps/theming/tests/CapabilitiesTest.php
index 277dd5b6a7a..1274be929ef 100644
--- a/apps/theming/tests/CapabilitiesTest.php
+++ b/apps/theming/tests/CapabilitiesTest.php
@@ -14,6 +14,7 @@ use OCP\Files\IAppData;
use OCP\IConfig;
use OCP\IURLGenerator;
use OCP\IUserSession;
+use OCP\ServerVersion;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
@@ -169,7 +170,7 @@ class CapabilitiesTest extends TestCase {
->method('getLogo')
->willReturn($logo);
- $util = new Util($this->config, $this->createMock(IAppManager::class), $this->createMock(IAppData::class), $this->createMock(ImageManager::class));
+ $util = new Util($this->createMock(ServerVersion::class), $this->config, $this->createMock(IAppManager::class), $this->createMock(IAppData::class), $this->createMock(ImageManager::class));
$this->util->expects($this->exactly(3))
->method('elementColor')
->with($color)
diff --git a/apps/theming/tests/IconBuilderTest.php b/apps/theming/tests/IconBuilderTest.php
index bef48448bfa..ec7bd8bcc55 100644
--- a/apps/theming/tests/IconBuilderTest.php
+++ b/apps/theming/tests/IconBuilderTest.php
@@ -13,6 +13,7 @@ use OCA\Theming\Util;
use OCP\App\IAppManager;
use OCP\Files\NotFoundException;
use OCP\IConfig;
+use OCP\ServerVersion;
use PHPUnit\Framework\Error\Warning;
use Test\TestCase;
@@ -41,7 +42,7 @@ class IconBuilderTest extends TestCase {
$this->themingDefaults = $this->createMock(ThemingDefaults::class);
$this->appManager = $this->createMock(IAppManager::class);
$this->imageManager = $this->createMock(ImageManager::class);
- $this->util = new Util($this->config, $this->appManager, $this->appData, $this->imageManager);
+ $this->util = new Util($this->createMock(ServerVersion::class), $this->config, $this->appManager, $this->appData, $this->imageManager);
$this->iconBuilder = new IconBuilder($this->themingDefaults, $this->util, $this->imageManager);
}
diff --git a/apps/theming/tests/Themes/DarkHighContrastThemeTest.php b/apps/theming/tests/Themes/DarkHighContrastThemeTest.php
index 63fb2bf414d..16f7e86d217 100644
--- a/apps/theming/tests/Themes/DarkHighContrastThemeTest.php
+++ b/apps/theming/tests/Themes/DarkHighContrastThemeTest.php
@@ -18,6 +18,7 @@ use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUserSession;
+use OCP\ServerVersion;
use PHPUnit\Framework\MockObject\MockObject;
class DarkHighContrastThemeTest extends AccessibleThemeTestCase {
@@ -49,6 +50,7 @@ class DarkHighContrastThemeTest extends AccessibleThemeTestCase {
$this->appManager = $this->createMock(IAppManager::class);
$this->util = new Util(
+ $this->createMock(ServerVersion::class),
$this->config,
$this->appManager,
$this->createMock(IAppData::class),
diff --git a/apps/theming/tests/Themes/DarkThemeTest.php b/apps/theming/tests/Themes/DarkThemeTest.php
index f53028d3a63..ea570adf21d 100644
--- a/apps/theming/tests/Themes/DarkThemeTest.php
+++ b/apps/theming/tests/Themes/DarkThemeTest.php
@@ -18,6 +18,7 @@ use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUserSession;
+use OCP\ServerVersion;
use PHPUnit\Framework\MockObject\MockObject;
class DarkThemeTest extends AccessibleThemeTestCase {
@@ -46,6 +47,7 @@ class DarkThemeTest extends AccessibleThemeTestCase {
$this->appManager = $this->createMock(IAppManager::class);
$this->util = new Util(
+ $this->createMock(ServerVersion::class),
$this->config,
$this->appManager,
$this->createMock(IAppData::class),
diff --git a/apps/theming/tests/Themes/DefaultThemeTest.php b/apps/theming/tests/Themes/DefaultThemeTest.php
index db6a5bf1cfc..b463cf4567c 100644
--- a/apps/theming/tests/Themes/DefaultThemeTest.php
+++ b/apps/theming/tests/Themes/DefaultThemeTest.php
@@ -18,6 +18,7 @@ use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUserSession;
+use OCP\ServerVersion;
use PHPUnit\Framework\MockObject\MockObject;
class DefaultThemeTest extends AccessibleThemeTestCase {
@@ -46,6 +47,7 @@ class DefaultThemeTest extends AccessibleThemeTestCase {
$this->appManager = $this->createMock(IAppManager::class);
$this->util = new Util(
+ $this->createMock(ServerVersion::class),
$this->config,
$this->appManager,
$this->createMock(IAppData::class),
diff --git a/apps/theming/tests/Themes/DyslexiaFontTest.php b/apps/theming/tests/Themes/DyslexiaFontTest.php
index 53505f4bd03..a022ee40114 100644
--- a/apps/theming/tests/Themes/DyslexiaFontTest.php
+++ b/apps/theming/tests/Themes/DyslexiaFontTest.php
@@ -19,6 +19,7 @@ use OCP\IL10N;
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\IUserSession;
+use OCP\ServerVersion;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
@@ -49,6 +50,7 @@ class DyslexiaFontTest extends TestCase {
$this->appManager = $this->createMock(IAppManager::class);
$util = new Util(
+ $this->createMock(ServerVersion::class),
$this->config,
$this->appManager,
$this->createMock(IAppData::class),
diff --git a/apps/theming/tests/Themes/HighContrastThemeTest.php b/apps/theming/tests/Themes/HighContrastThemeTest.php
index 603bf08a0ee..71576caf841 100644
--- a/apps/theming/tests/Themes/HighContrastThemeTest.php
+++ b/apps/theming/tests/Themes/HighContrastThemeTest.php
@@ -18,6 +18,7 @@ use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUserSession;
+use OCP\ServerVersion;
use PHPUnit\Framework\MockObject\MockObject;
class HighContrastThemeTest extends AccessibleThemeTestCase {
@@ -49,6 +50,7 @@ class HighContrastThemeTest extends AccessibleThemeTestCase {
$this->appManager = $this->createMock(IAppManager::class);
$this->util = new Util(
+ $this->createMock(ServerVersion::class),
$this->config,
$this->appManager,
$this->createMock(IAppData::class),
diff --git a/apps/theming/tests/UtilTest.php b/apps/theming/tests/UtilTest.php
index ba160684b7a..9a05c77a274 100644
--- a/apps/theming/tests/UtilTest.php
+++ b/apps/theming/tests/UtilTest.php
@@ -13,6 +13,7 @@ use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\IConfig;
+use OCP\ServerVersion;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
@@ -30,7 +31,7 @@ class UtilTest extends TestCase {
$this->appData = $this->createMock(IAppData::class);
$this->appManager = \OCP\Server::get(IAppManager::class);
$this->imageManager = $this->createMock(ImageManager::class);
- $this->util = new Util($this->config, $this->appManager, $this->appData, $this->imageManager);
+ $this->util = new Util($this->createMock(ServerVersion::class), $this->config, $this->appManager, $this->appData, $this->imageManager);
}
public function dataColorContrast() {