@@ -123,6 +123,24 @@ public function testGetFaviconThemed(): void {
123123 $ this ->assertEquals ($ expected , $ this ->iconController ->getFavicon ());
124124 }
125125
126+ public function testGetFaviconUploaded (): void {
127+ // a custom favicon was uploaded, so it must be served as-is and the
128+ // app-specific generation path must not overwrite it
129+ $ file = $ this ->iconFileMock ('favicon.ico ' , 'filecontent ' );
130+ $ this ->imageManager ->expects ($ this ->once ())
131+ ->method ('getImage ' )
132+ ->with ('favicon ' , false )
133+ ->willReturn ($ file );
134+ $ this ->imageManager ->expects ($ this ->never ())
135+ ->method ('getCachedImage ' );
136+ $ this ->iconBuilder ->expects ($ this ->never ())
137+ ->method ('getFavicon ' );
138+
139+ $ expected = new FileDisplayResponse ($ file , Http::STATUS_OK , ['Content-Type ' => 'image/x-icon ' ]);
140+ $ expected ->cacheFor (86400 );
141+ $ this ->assertEquals ($ expected , $ this ->iconController ->getFavicon ());
142+ }
143+
126144 public function testGetFaviconDefault (): void {
127145 $ this ->imageManager ->expects ($ this ->once ())
128146 ->method ('getImage ' )
@@ -178,6 +196,24 @@ public function testGetTouchIconDefault(): void {
178196 $ this ->assertEquals ($ expected , $ this ->iconController ->getTouchIcon ());
179197 }
180198
199+ public function testGetTouchIconUploaded (): void {
200+ // a custom favicon was uploaded, so it must be served as-is and the
201+ // app-specific generation path must not overwrite it
202+ $ file = $ this ->iconFileMock ('favicon.png ' , 'filecontent ' );
203+ $ this ->imageManager ->expects ($ this ->once ())
204+ ->method ('getImage ' )
205+ ->with ('favicon ' )
206+ ->willReturn ($ file );
207+ $ this ->imageManager ->expects ($ this ->never ())
208+ ->method ('getCachedImage ' );
209+ $ this ->iconBuilder ->expects ($ this ->never ())
210+ ->method ('getTouchIcon ' );
211+
212+ $ expected = new FileDisplayResponse ($ file , Http::STATUS_OK , ['Content-Type ' => 'image type ' ]);
213+ $ expected ->cacheFor (86400 );
214+ $ this ->assertEquals ($ expected , $ this ->iconController ->getTouchIcon ());
215+ }
216+
181217 public function testGetTouchIconFail (): void {
182218 $ this ->imageManager ->expects ($ this ->once ())
183219 ->method ('getImage ' )
0 commit comments