Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix themings tests and get rid of deprecated at matcher
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc committed Nov 15, 2022
commit 38440563dd47edd2501f1f0d207b463699fa9b6b
58 changes: 30 additions & 28 deletions apps/theming/tests/ThemingDefaultsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,30 +424,24 @@ public function testGetShortFooterInvalidPrivacy($invalidPrivacyUrl) {

public function testGetColorPrimaryWithDefault() {
$this->config
->expects($this->at(0))
->method('getAppValue')
->with('theming', 'color', null)
->willReturn($this->defaults->getColorPrimary());
$this->config
->expects($this->at(1))
->expects($this->exactly(2))
->method('getAppValue')
->with('theming', 'disable-user-theming', 'no')
->willReturn('no');
->willReturnMap([
['theming', 'disable-user-theming', 'no', 'no'],
['theming', 'color', '', $this->defaults->getColorPrimary()],
]);

$this->assertEquals($this->defaults->getColorPrimary(), $this->template->getColorPrimary());
}

public function testGetColorPrimaryWithCustom() {
$this->config
->expects($this->at(0))
->method('getAppValue')
->with('theming', 'color', null)
->willReturn('#fff');
$this->config
->expects($this->at(1))
->expects($this->exactly(2))
->method('getAppValue')
->with('theming', 'disable-user-theming', 'no')
->willReturn('no');
->willReturnMap([
['theming', 'disable-user-theming', 'no', 'no'],
['theming', 'color', '', '#fff'],
]);

$this->assertEquals('#fff', $this->template->getColorPrimary());
}
Expand All @@ -461,10 +455,12 @@ public function testGetColorPrimaryWithDefaultBackground() {
->method('getUID')
->willReturn('user');
$this->config
->expects($this->at(1))
->expects($this->exactly(2))
->method('getAppValue')
->with('theming', 'color')
->willReturn('');
->willReturnMap([
['theming', 'disable-user-theming', 'no', 'no'],
['theming', 'color', '', ''],
]);

$this->assertEquals(BackgroundService::DEFAULT_COLOR, $this->template->getColorPrimary());
}
Expand All @@ -486,10 +482,12 @@ public function testGetColorPrimaryWithCustomBackground() {
->with('user', 'theming', 'background', '')
->willReturn(array_keys(BackgroundService::SHIPPED_BACKGROUNDS)[$backgroundIndex]);
$this->config
->expects($this->at(1))
->expects($this->exactly(2))
->method('getAppValue')
->with('theming', 'color')
->willReturn('');
->willReturnMap([
['theming', 'disable-user-theming', 'no', 'no'],
['theming', 'color', '', ''],
]);

$this->assertEquals($background['primary_color'], $this->template->getColorPrimary());
}
Expand All @@ -509,10 +507,12 @@ public function testGetColorPrimaryWithCustomBackgroundColor() {
->with('user', 'theming', 'background', '')
->willReturn('#fff');
$this->config
->expects($this->at(1))
->expects($this->exactly(2))
->method('getAppValue')
->with('theming', 'color')
->willReturn('');
->willReturnMap([
['theming', 'disable-user-theming', 'no', 'no'],
['theming', 'color', '', ''],
]);

$this->assertEquals('#fff', $this->template->getColorPrimary());
}
Expand All @@ -532,10 +532,12 @@ public function testGetColorPrimaryWithInvalidCustomBackgroundColor() {
->with('user', 'theming', 'background', '')
->willReturn('nextcloud');
$this->config
->expects($this->at(1))
->expects($this->exactly(3))
->method('getAppValue')
->with('theming', 'color')
->willReturn('');
->willReturnMap([
['theming', 'disable-user-theming', 'no', 'no'],
['theming', 'color', '', ''],
]);

$this->assertEquals($this->template->getDefaultColorPrimary(), $this->template->getColorPrimary());
}
Expand Down