Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nickvergessen committed Jul 15, 2016
1 parent f35b696 commit ec6f696
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions apps/theming/tests/lib/TemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,26 @@ public function testGetNameWithCustom() {
$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())
Expand Down Expand Up @@ -172,6 +192,32 @@ public function testGetSloganWithCustom() {
$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())
Expand Down

0 comments on commit ec6f696

Please sign in to comment.