diff options
author | Julius Härtl <jus@bitgrid.net> | 2017-05-14 23:48:51 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2017-05-17 10:11:29 +0200 |
commit | 1157f413c9a5c89994f0477b97726a2aef64e44e (patch) | |
tree | cb95f5c237e5f7a8584e4cc84f04396e45ed7fc2 /apps/theming/tests | |
parent | 443cbdc73931c0deec5bc01634ec9b512486d769 (diff) | |
download | nextcloud-server-1157f413c9a5c89994f0477b97726a2aef64e44e.tar.gz nextcloud-server-1157f413c9a5c89994f0477b97726a2aef64e44e.zip |
Fallback to default favicon
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/theming/tests')
-rw-r--r-- | apps/theming/tests/Controller/IconControllerTest.php | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/apps/theming/tests/Controller/IconControllerTest.php b/apps/theming/tests/Controller/IconControllerTest.php index add11df3e6d..d93c2259472 100644 --- a/apps/theming/tests/Controller/IconControllerTest.php +++ b/apps/theming/tests/Controller/IconControllerTest.php @@ -28,6 +28,7 @@ use OCA\Theming\IconBuilder; use OCA\Theming\ImageManager; use OCA\Theming\ThemingDefaults; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\DataDisplayResponse; use OCP\AppFramework\Http\NotFoundResponse; use OCP\Files\NotFoundException; use OCP\IConfig; @@ -150,11 +151,15 @@ class IconControllerTest extends TestCase { $this->themingDefaults->expects($this->any()) ->method('shouldReplaceIcons') ->willReturn(false); - $expected = new Http\Response(); - $expected->setStatus(Http::STATUS_NOT_FOUND); - $expected->cacheFor(0); - $expected->setLastModified(new \DateTime('now', new \DateTimeZone('GMT'))); - $this->assertInstanceOf(NotFoundResponse::class, $this->iconController->getFavicon()); + $fallbackLogo = \OC::$SERVERROOT . '/core/img/favicon.png'; + $expected = new DataDisplayResponse(file_get_contents($fallbackLogo), Http::STATUS_OK); + $expected->cacheFor(86400); + $expires = new \DateTime(); + $expires->setTimestamp($this->timeFactory->getTime()); + $expires->add(new \DateInterval('PT24H')); + $expected->addHeader('Expires', $expires->format(\DateTime::RFC2822)); + $expected->addHeader('Pragma', 'cache'); + $this->assertEquals($expected, $this->iconController->getFavicon()); } public function testGetTouchIconDefault() { @@ -195,7 +200,15 @@ class IconControllerTest extends TestCase { $this->themingDefaults->expects($this->any()) ->method('shouldReplaceIcons') ->willReturn(false); - $this->assertInstanceOf(NotFoundResponse::class, $this->iconController->getTouchIcon()); + $fallbackLogo = \OC::$SERVERROOT . '/core/img/favicon-touch.png'; + $expected = new DataDisplayResponse(file_get_contents($fallbackLogo), Http::STATUS_OK); + $expected->cacheFor(86400); + $expires = new \DateTime(); + $expires->setTimestamp($this->timeFactory->getTime()); + $expires->add(new \DateInterval('PT24H')); + $expected->addHeader('Expires', $expires->format(\DateTime::RFC2822)); + $expected->addHeader('Pragma', 'cache'); + $this->assertEquals($expected, $this->iconController->getTouchIcon()); } } |