浏览代码

Add unit tests

tags/v10.0RC1
Joas Schilling 8 年前
父节点
当前提交
ec6f696978
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 46 次插入0 次删除
  1. 46
    0
      apps/theming/tests/lib/TemplateTest.php

+ 46
- 0
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())

正在加载...
取消
保存