Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'apps/theming/tests/ThemingDefaultsTest.php')
-rw-r--r--apps/theming/tests/ThemingDefaultsTest.php71
1 files changed, 69 insertions, 2 deletions
diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php
index c943af01c6c..b454b21f840 100644
--- a/apps/theming/tests/ThemingDefaultsTest.php
+++ b/apps/theming/tests/ThemingDefaultsTest.php
@@ -195,6 +195,27 @@ class ThemingDefaultsTest extends TestCase {
$this->assertEquals('https://example.com/', $this->template->getBaseUrl());
}
+ public function imprintUrlProvider() {
+ return [
+ [ '' ],
+ [ 'https://example.com/imprint.html']
+ ];
+ }
+
+ /**
+ * @param $imprintUrl
+ * @dataProvider imprintUrlProvider
+ */
+ public function testGetImprintURL($imprintUrl) {
+ $this->config
+ ->expects($this->once())
+ ->method('getAppValue')
+ ->with('theming', 'imprintUrl', '')
+ ->willReturn($imprintUrl);
+
+ $this->assertEquals($imprintUrl, $this->template->getImprintUrl());
+ }
+
public function testGetSloganWithDefault() {
$this->config
->expects($this->once())
@@ -217,12 +238,13 @@ class ThemingDefaultsTest extends TestCase {
public function testGetShortFooter() {
$this->config
- ->expects($this->exactly(3))
+ ->expects($this->exactly(4))
->method('getAppValue')
->willReturnMap([
['theming', 'url', $this->defaults->getBaseUrl(), 'url'],
['theming', 'name', 'Nextcloud', 'Name'],
['theming', 'slogan', $this->defaults->getSlogan(), 'Slogan'],
+ ['theming', 'imprintUrl', '', ''],
]);
$this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener">Name</a> – Slogan', $this->template->getShortFooter());
@@ -230,17 +252,62 @@ class ThemingDefaultsTest extends TestCase {
public function testGetShortFooterEmptySlogan() {
$this->config
- ->expects($this->exactly(3))
+ ->expects($this->exactly(4))
->method('getAppValue')
->willReturnMap([
['theming', 'url', $this->defaults->getBaseUrl(), 'url'],
['theming', 'name', 'Nextcloud', 'Name'],
['theming', 'slogan', $this->defaults->getSlogan(), ''],
+ ['theming', 'imprintUrl', '', ''],
]);
$this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener">Name</a>', $this->template->getShortFooter());
}
+ public function testGetShortFooterImprint() {
+ $this->config
+ ->expects($this->exactly(4))
+ ->method('getAppValue')
+ ->willReturnMap([
+ ['theming', 'url', $this->defaults->getBaseUrl(), 'url'],
+ ['theming', 'name', 'Nextcloud', 'Name'],
+ ['theming', 'slogan', $this->defaults->getSlogan(), 'Slogan'],
+ ['theming', 'imprintUrl', '', 'https://example.com/imprint'],
+ ]);
+
+ $this->l10n
+ ->expects($this->any())
+ ->method('t')
+ ->willReturnArgument(0);
+
+ $this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener">Name</a> – Slogan<br/><a href="https://example.com/imprint" class="legal" target="_blank" rel="noreferrer noopener">Legal notice</a>', $this->template->getShortFooter());
+ }
+
+ public function invalidImprintUrlProvider() {
+ return [
+ ['example.com/imprint'], # missing scheme
+ ['https:///imprint'], # missing host
+ ];
+ }
+
+ /**
+ * @param $invalidImprintUrl
+ * @dataProvider invalidImprintUrlProvider
+ */
+ public function testGetShortFooterInvalidImprint($invalidImprintUrl) {
+ $this->config
+ ->expects($this->exactly(4))
+ ->method('getAppValue')
+ ->willReturnMap([
+ ['theming', 'url', $this->defaults->getBaseUrl(), 'url'],
+ ['theming', 'name', 'Nextcloud', 'Name'],
+ ['theming', 'slogan', $this->defaults->getSlogan(), 'Slogan'],
+ ['theming', 'imprintUrl', '', $invalidImprintUrl],
+ ]);
+
+ $this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener">Name</a> – Slogan', $this->template->getShortFooter());
+ }
+
public function testgetColorPrimaryWithDefault() {
$this->config
->expects($this->once())