summaryrefslogtreecommitdiffstats
path: root/apps/theming/tests
diff options
context:
space:
mode:
authorJulius Haertl <jus@bitgrid.net>2016-08-23 22:02:28 +0200
committerJulius Haertl <jus@bitgrid.net>2016-08-24 00:40:22 +0200
commit80fe499707b280424fd032c33dcb3ff956e3a282 (patch)
treeb3beed5deda5a6f465680b25192170160cb7e67f /apps/theming/tests
parent3ed102497e2a3b732a0c7e91398b5bb6d147d12a (diff)
downloadnextcloud-server-80fe499707b280424fd032c33dcb3ff956e3a282.tar.gz
nextcloud-server-80fe499707b280424fd032c33dcb3ff956e3a282.zip
Theming: Add logo and background to ThemingDefaults
Diffstat (limited to 'apps/theming/tests')
-rw-r--r--apps/theming/tests/ThemingDefaultsTest.php52
1 files changed, 50 insertions, 2 deletions
diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php
index 6ef7deea152..0aa88c3115e 100644
--- a/apps/theming/tests/ThemingDefaultsTest.php
+++ b/apps/theming/tests/ThemingDefaultsTest.php
@@ -27,6 +27,7 @@ use OCA\Theming\ThemingDefaults;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
+use OCP\Files\IRootFolder;
use Test\TestCase;
class ThemingDefaultsTest extends TestCase {
@@ -40,11 +41,17 @@ class ThemingDefaultsTest extends TestCase {
private $defaults;
/** @var ThemingDefaults */
private $template;
+ /** @var IRootFolder */
+ private $rootFolder;
public function setUp() {
+ parent::setUp();
$this->config = $this->getMock('\\OCP\\IConfig');
$this->l10n = $this->getMock('\\OCP\\IL10N');
$this->urlGenerator = $this->getMock('\\OCP\\IURLGenerator');
+ $this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')
+ ->disableOriginalConstructor()
+ ->getMock();
$this->defaults = $this->getMockBuilder('\\OC_Defaults')
->disableOriginalConstructor()
->getMock();
@@ -68,10 +75,11 @@ class ThemingDefaultsTest extends TestCase {
$this->config,
$this->l10n,
$this->urlGenerator,
- $this->defaults
+ $this->defaults,
+ $this->rootFolder
);
- return parent::setUp();
+ //return parent::setUp();
}
public function testGetNameWithDefault() {
@@ -368,4 +376,44 @@ class ThemingDefaultsTest extends TestCase {
$this->assertSame('', $this->template->undo('defaultitem'));
}
+
+ public function testGetBackgroundDefault() {
+ $this->config
+ ->expects($this->once())
+ ->method('getAppValue')
+ ->with('theming', 'backgroundMime')
+ ->willReturn('');
+ $expected = $this->urlGenerator->imagePath('core','background.jpg');
+ $this->assertEquals($expected, $this->template->getBackground());
+ }
+
+ public function testGetBackgroundCustom() {
+ $this->config
+ ->expects($this->once())
+ ->method('getAppValue')
+ ->with('theming', 'backgroundMime')
+ ->willReturn('image/svg+xml');
+ $expected = $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground');
+ $this->assertEquals($expected, $this->template->getBackground());
+ }
+
+ public function testGetLogoDefault() {
+ $this->config
+ ->expects($this->once())
+ ->method('getAppValue')
+ ->with('theming', 'logoMime')
+ ->willReturn('');
+ $expected = $this->urlGenerator->imagePath('core','logo.svg');
+ $this->assertEquals($expected, $this->template->getLogo());
+ }
+
+ public function testGetLogoCustom() {
+ $this->config
+ ->expects($this->once())
+ ->method('getAppValue')
+ ->with('theming', 'logoMime')
+ ->willReturn('image/svg+xml');
+ $expected = $this->urlGenerator->linkToRoute('theming.Theming.getLogo');
+ $this->assertEquals($expected, $this->template->getLogo());
+ }
}