aboutsummaryrefslogtreecommitdiffstats
path: root/apps/theming/tests
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-11-15 16:29:26 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2022-11-15 16:29:26 +0100
commit38440563dd47edd2501f1f0d207b463699fa9b6b (patch)
tree1f1644a2987811601270e04832fd32b9066ad308 /apps/theming/tests
parent68363f69443e4332b5433a7078cb7fca930a3ebe (diff)
downloadnextcloud-server-38440563dd47edd2501f1f0d207b463699fa9b6b.tar.gz
nextcloud-server-38440563dd47edd2501f1f0d207b463699fa9b6b.zip
Fix themings tests and get rid of deprecated at matcher
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/theming/tests')
-rw-r--r--apps/theming/tests/ThemingDefaultsTest.php58
1 files changed, 30 insertions, 28 deletions
diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php
index c09c7b5f649..e3e6f2d1df7 100644
--- a/apps/theming/tests/ThemingDefaultsTest.php
+++ b/apps/theming/tests/ThemingDefaultsTest.php
@@ -424,30 +424,24 @@ class ThemingDefaultsTest extends TestCase {
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());
}
@@ -461,10 +455,12 @@ class ThemingDefaultsTest extends TestCase {
->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());
}
@@ -486,10 +482,12 @@ class ThemingDefaultsTest extends TestCase {
->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());
}
@@ -509,10 +507,12 @@ class ThemingDefaultsTest extends TestCase {
->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());
}
@@ -532,10 +532,12 @@ class ThemingDefaultsTest extends TestCase {
->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());
}