Simplify SettingsService Test

Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
Raimund Schlüßler 2019-07-20 10:15:14 +02:00
parent 758f55d48f
commit 1ceeb68158
No known key found for this signature in database
GPG Key ID: 036FA7EB1A599178
1 changed files with 35 additions and 34 deletions

View File

@ -54,47 +54,48 @@ class SettingsServiceTest extends TestCase {
public function testGet() {
$return = [
'defaultCalendarId' => 'personal',
'showHidden' => 0,
'showHidden' => 1,
'sortOrder' => 'default',
'sortDirection' => false,
'userID' => $this->userId
];
$this->settings->expects($this->at(0))
->method('getUserValue')
->with(
$this->equalTo($this->userId),
$this->equalTo($this->appName),
'various_defaultCalendarId'
)
->will($this->returnValue('personal'));
$this->settings->expects($this->at(1))
->method('getUserValue')
->with(
$this->equalTo($this->userId),
$this->equalTo($this->appName),
'various_showHidden'
)
->will($this->returnValue(0));
$map = [
[
$this->userId,
$this->appName,
'various_defaultCalendarId',
'',
'personal'
],
[
$this->userId,
$this->appName,
'various_showHidden',
'',
1
],
[
$this->userId,
$this->appName,
'various_sortOrder',
'',
'default'
],
[
$this->userId,
$this->appName,
'various_sortDirection',
'',
false
]
];
$this->settings->expects($this->at(2))
$this->settings->expects($this->any())
->method('getUserValue')
->with(
$this->equalTo($this->userId),
$this->equalTo($this->appName),
'various_sortOrder'
)
->will($this->returnValue('default'));
$this->settings->expects($this->at(3))
->method('getUserValue')
->with(
$this->equalTo($this->userId),
$this->equalTo($this->appName),
'various_sortDirection'
)
->will($this->returnValue(false));
->will(
$this->returnValueMap($map)
);
$result = $this->settingsService->get();