diff options
author | Joas Schilling <coding@schilljs.com> | 2025-05-20 22:28:10 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2025-05-20 22:33:18 +0200 |
commit | a8082ff12b8264766a003513386a1a6f5c3e0c0b (patch) | |
tree | 5814cd6534169a516d7f019c8b53ac06d4163465 | |
parent | 621b67987c13c7addffe009d2cc901f90c7adaa5 (diff) | |
download | nextcloud-server-bugfix/noid/fix-icon-builder-warning.tar.gz nextcloud-server-bugfix/noid/fix-icon-builder-warning.zip |
fix(theming): Instead of expecting a warning handle it properlybugfix/noid/fix-icon-builder-warning
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | apps/theming/lib/IconBuilder.php | 9 | ||||
-rw-r--r-- | apps/theming/tests/IconBuilderTest.php | 9 |
2 files changed, 7 insertions, 11 deletions
diff --git a/apps/theming/lib/IconBuilder.php b/apps/theming/lib/IconBuilder.php index 4ab9857e2ce..456883634c8 100644 --- a/apps/theming/lib/IconBuilder.php +++ b/apps/theming/lib/IconBuilder.php @@ -90,18 +90,17 @@ class IconBuilder { * Render app icon on themed background color * fallback to logo * - * @param $app string app name - * @param $size int size of the icon in px + * @param string $app app name + * @param int $size size of the icon in px * @return Imagick|false */ public function renderAppIcon($app, $size) { $appIcon = $this->util->getAppIcon($app); - if ($appIcon === false) { - return false; - } if ($appIcon instanceof ISimpleFile) { $appIconContent = $appIcon->getContent(); $mime = $appIcon->getMimeType(); + } elseif (!file_exists($appIcon)) { + return false; } else { $appIconContent = file_get_contents($appIcon); $mime = mime_content_type($appIcon); diff --git a/apps/theming/tests/IconBuilderTest.php b/apps/theming/tests/IconBuilderTest.php index ec7bd8bcc55..d6c1c49c1b3 100644 --- a/apps/theming/tests/IconBuilderTest.php +++ b/apps/theming/tests/IconBuilderTest.php @@ -165,8 +165,7 @@ class IconBuilderTest extends TestCase { public function testGetFaviconNotFound(): void { $this->checkImagick(); - $this->expectWarning(Warning::class); - $util = $this->getMockBuilder(Util::class)->disableOriginalConstructor()->getMock(); + $util = $this->createMock(Util::class); $iconBuilder = new IconBuilder($this->themingDefaults, $util, $this->imageManager); $this->imageManager->expects($this->once()) ->method('shouldReplaceIcons') @@ -179,8 +178,7 @@ class IconBuilderTest extends TestCase { public function testGetTouchIconNotFound(): void { $this->checkImagick(); - $this->expectWarning(Warning::class); - $util = $this->getMockBuilder(Util::class)->disableOriginalConstructor()->getMock(); + $util = $this->createMock(Util::class); $iconBuilder = new IconBuilder($this->themingDefaults, $util, $this->imageManager); $util->expects($this->once()) ->method('getAppIcon') @@ -190,8 +188,7 @@ class IconBuilderTest extends TestCase { public function testColorSvgNotFound(): void { $this->checkImagick(); - $this->expectWarning(Warning::class); - $util = $this->getMockBuilder(Util::class)->disableOriginalConstructor()->getMock(); + $util = $this->createMock(Util::class); $iconBuilder = new IconBuilder($this->themingDefaults, $util, $this->imageManager); $util->expects($this->once()) ->method('getAppImage') |