diff options
-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') |