summaryrefslogtreecommitdiffstats
path: root/apps/theming/tests/ThemingDefaultsTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/theming/tests/ThemingDefaultsTest.php')
-rw-r--r--apps/theming/tests/ThemingDefaultsTest.php34
1 files changed, 33 insertions, 1 deletions
diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php
index c6d1fec91dd..abd85a612c9 100644
--- a/apps/theming/tests/ThemingDefaultsTest.php
+++ b/apps/theming/tests/ThemingDefaultsTest.php
@@ -24,6 +24,7 @@
namespace OCA\Theming\Tests;
use OCA\Theming\ThemingDefaults;
+use OCP\App\IAppManager;
use OCP\Files\IAppData;
use OCA\Theming\Util;
use OCP\Files\NotFoundException;
@@ -55,6 +56,8 @@ class ThemingDefaultsTest extends TestCase {
private $util;
/** @var ICache|\PHPUnit_Framework_MockObject_MockObject */
private $cache;
+ /** @var IAppManager|\PHPUnit_Framework_MockObject_MockObject */
+ private $appManager;
public function setUp() {
parent::setUp();
@@ -65,6 +68,7 @@ class ThemingDefaultsTest extends TestCase {
$this->cacheFactory = $this->createMock(ICacheFactory::class);
$this->cache = $this->createMock(ICache::class);
$this->util = $this->createMock(Util::class);
+ $this->appManager = $this->createMock(IAppManager::class);
$this->defaults = new \OC_Defaults();
$this->cacheFactory
->expects($this->any())
@@ -77,7 +81,8 @@ class ThemingDefaultsTest extends TestCase {
$this->urlGenerator,
$this->appData,
$this->cacheFactory,
- $this->util
+ $this->util,
+ $this->appManager
);
}
@@ -607,4 +612,31 @@ class ThemingDefaultsTest extends TestCase {
$this->assertEquals('1234567890', $this->template->getiTunesAppId());
}
+ public function dataReplaceImagePath() {
+ return [
+ ['core', 'test.png', false],
+ ['core', 'manifest.json'],
+ ['core', 'favicon.ico'],
+ ['core', 'favicon-touch.png']
+ ];
+ }
+
+ /** @dataProvider dataReplaceImagePath */
+ public function testReplaceImagePath($app, $image, $result = 'themingRoute?v=0') {
+ $this->cache->expects($this->any())
+ ->method('get')
+ ->with('shouldReplaceIcons')
+ ->willReturn(true);
+ $this->config
+ ->expects($this->any())
+ ->method('getAppValue')
+ ->with('theming', 'cachebuster', '0')
+ ->willReturn('0');
+ $this->urlGenerator
+ ->expects($this->any())
+ ->method('linkToRoute')
+ ->willReturn('themingRoute');
+ $this->assertEquals($result, $this->template->replaceImagePath($app, $image));
+ }
+
}