summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-07-15 11:54:47 +0200
committerJoas Schilling <coding@schilljs.com>2016-07-15 11:54:47 +0200
commitec6f6969789ca2f455c0d2fd04557337c782176b (patch)
treee879936385b627c13cc748de97f82461fca5690c /apps
parentf35b696a2d748925bf6fb42d0b5472c8fa900aa1 (diff)
downloadnextcloud-server-ec6f6969789ca2f455c0d2fd04557337c782176b.tar.gz
nextcloud-server-ec6f6969789ca2f455c0d2fd04557337c782176b.zip
Add unit tests
Diffstat (limited to 'apps')
-rw-r--r--apps/theming/tests/lib/TemplateTest.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/apps/theming/tests/lib/TemplateTest.php b/apps/theming/tests/lib/TemplateTest.php
index 1ee860f93c4..cd7115d2086 100644
--- a/apps/theming/tests/lib/TemplateTest.php
+++ b/apps/theming/tests/lib/TemplateTest.php
@@ -91,6 +91,26 @@ class TemplateTest extends TestCase {
$this->assertEquals('MyCustomCloud', $this->template->getName());
}
+ public function testGetHTMLNameWithDefault() {
+ $this->config
+ ->expects($this->once())
+ ->method('getAppValue')
+ ->with('theming', 'name', 'Nextcloud')
+ ->willReturn('Nextcloud');
+
+ $this->assertEquals('Nextcloud', $this->template->getHTMLName());
+ }
+
+ public function testGetHTMLNameWithCustom() {
+ $this->config
+ ->expects($this->once())
+ ->method('getAppValue')
+ ->with('theming', 'name', 'Nextcloud')
+ ->willReturn('MyCustomCloud');
+
+ $this->assertEquals('MyCustomCloud', $this->template->getHTMLName());
+ }
+
public function testGetTitleWithDefault() {
$this->config
->expects($this->once())
@@ -172,6 +192,32 @@ class TemplateTest extends TestCase {
$this->assertEquals('My custom Slogan', $this->template->getSlogan());
}
+ public function testGetShortFooter() {
+ $this->config
+ ->expects($this->exactly(3))
+ ->method('getAppValue')
+ ->willReturnMap([
+ ['theming', 'url', 'https://nextcloud.com/', 'url'],
+ ['theming', 'name', 'Nextcloud', 'Name'],
+ ['theming', 'slogan', 'Safe Data', 'Slogan'],
+ ]);
+
+ $this->assertEquals('<a href="url" target="_blank" rel="noreferrer">Name</a> – Slogan', $this->template->getShortFooter());
+ }
+
+ public function testGetShortFooterEmptySlogan() {
+ $this->config
+ ->expects($this->exactly(3))
+ ->method('getAppValue')
+ ->willReturnMap([
+ ['theming', 'url', 'https://nextcloud.com/', 'url'],
+ ['theming', 'name', 'Nextcloud', 'Name'],
+ ['theming', 'slogan', 'Safe Data', ''],
+ ]);
+
+ $this->assertEquals('<a href="url" target="_blank" rel="noreferrer">Name</a>', $this->template->getShortFooter());
+ }
+
public function testGetMailHeaderColorWithDefault() {
$this->config
->expects($this->once())