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