Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions apps/theming/tests/Controller/IconControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,42 @@ public function testGetTouchIconDefault(): void {
$this->assertEquals($expected, $this->iconController->getTouchIcon());
}

public function testGetFaviconUploaded(): void {
// a custom favicon was uploaded, so it must be served as-is and the
// app-specific generation path must not overwrite it
$file = $this->iconFileMock('favicon.ico', 'filecontent');
$this->imageManager->expects($this->once())
->method('getImage')
->with('favicon', false)
->willReturn($file);
$this->imageManager->expects($this->never())
->method('getCachedImage');
$this->iconBuilder->expects($this->never())
->method('getFavicon');

$expected = new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']);
$expected->cacheFor(86400);
$this->assertEquals($expected, $this->iconController->getFavicon());
}

public function testGetTouchIconUploaded(): void {
// a custom favicon was uploaded, so it must be served as-is and the
// app-specific generation path must not overwrite it
$file = $this->iconFileMock('favicon.png', 'filecontent');
$this->imageManager->expects($this->once())
->method('getImage')
->with('favicon')
->willReturn($file);
$this->imageManager->expects($this->never())
->method('getCachedImage');
$this->iconBuilder->expects($this->never())
->method('getTouchIcon');

$expected = new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']);
$expected->cacheFor(86400);
$this->assertEquals($expected, $this->iconController->getTouchIcon());
}

public function testGetTouchIconFail(): void {
$this->imageManager->expects($this->once())
->method('getImage')
Expand Down
Loading