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