summaryrefslogtreecommitdiffstats
path: root/apps/theming/tests
diff options
context:
space:
mode:
Diffstat (limited to 'apps/theming/tests')
-rw-r--r--apps/theming/tests/Controller/IconControllerTest.php9
-rw-r--r--apps/theming/tests/IconBuilderTest.php36
2 files changed, 39 insertions, 6 deletions
diff --git a/apps/theming/tests/Controller/IconControllerTest.php b/apps/theming/tests/Controller/IconControllerTest.php
index b1742db018f..591c1075492 100644
--- a/apps/theming/tests/Controller/IconControllerTest.php
+++ b/apps/theming/tests/Controller/IconControllerTest.php
@@ -27,6 +27,7 @@ use OC\Files\SimpleFS\SimpleFile;
use OCA\Theming\ImageManager;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataDisplayResponse;
+use OCP\AppFramework\Http\NotFoundResponse;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\IConfig;
@@ -153,7 +154,7 @@ class IconControllerTest extends TestCase {
$expected->setStatus(Http::STATUS_NOT_FOUND);
$expected->cacheFor(0);
$expected->setLastModified(new \DateTime('now', new \DateTimeZone('GMT')));
- $this->assertEquals($expected, $this->iconController->getFavicon());
+ $this->assertInstanceOf(NotFoundResponse::class, $this->iconController->getFavicon());
}
public function testGetTouchIconDefault() {
@@ -194,11 +195,7 @@ 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->assertEquals($expected, $this->iconController->getTouchIcon());
+ $this->assertInstanceOf(NotFoundResponse::class, $this->iconController->getTouchIcon());
}
}
diff --git a/apps/theming/tests/IconBuilderTest.php b/apps/theming/tests/IconBuilderTest.php
index 529518b30de..a13d4b9476d 100644
--- a/apps/theming/tests/IconBuilderTest.php
+++ b/apps/theming/tests/IconBuilderTest.php
@@ -25,6 +25,7 @@ namespace OCA\Theming\Tests;
use OCA\Theming\IconBuilder;
use OCA\Theming\ThemingDefaults;
use OCA\Theming\Util;
+use OCP\AppFramework\Http\NotFoundResponse;
use OCP\Files\IRootFolder;
use OCP\IConfig;
use Test\TestCase;
@@ -149,4 +150,39 @@ class IconBuilderTest extends TestCase {
// cloud be something like $expectedIcon->compareImages($icon, Imagick::METRIC_MEANABSOLUTEERROR)[1])
}
+ /**
+ * @expectedException \PHPUnit_Framework_Error_Warning
+ */
+ public function testGetFaviconNotFound() {
+ $util = $this->getMockBuilder(Util::class)->disableOriginalConstructor()->getMock();
+ $iconBuilder = new IconBuilder($this->themingDefaults, $util);
+ $util->expects($this->once())
+ ->method('getAppIcon')
+ ->willReturn('notexistingfile');
+ $this->assertFalse($iconBuilder->getFavicon('noapp'));
+ }
+
+ /**
+ * @expectedException \PHPUnit_Framework_Error_Warning
+ */
+ public function testGetTouchIconNotFound() {
+ $util = $this->getMockBuilder(Util::class)->disableOriginalConstructor()->getMock();
+ $iconBuilder = new IconBuilder($this->themingDefaults, $util);
+ $util->expects($this->once())
+ ->method('getAppIcon')
+ ->willReturn('notexistingfile');
+ $this->assertFalse($iconBuilder->getTouchIcon('noapp'));
+ }
+
+ /**
+ * @expectedException \PHPUnit_Framework_Error_Warning
+ */
+ public function testColorSvgNotFound() {
+ $util = $this->getMockBuilder(Util::class)->disableOriginalConstructor()->getMock();
+ $iconBuilder = new IconBuilder($this->themingDefaults, $util);
+ $util->expects($this->once())
+ ->method('getAppImage')
+ ->willReturn('notexistingfile');
+ $this->assertFalse($iconBuilder->colorSvg('noapp','noimage'));
+ }
}