Simplify SettingsService Test
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
parent
758f55d48f
commit
1ceeb68158
|
@ -54,47 +54,48 @@ class SettingsServiceTest extends TestCase {
|
||||||
public function testGet() {
|
public function testGet() {
|
||||||
$return = [
|
$return = [
|
||||||
'defaultCalendarId' => 'personal',
|
'defaultCalendarId' => 'personal',
|
||||||
'showHidden' => 0,
|
'showHidden' => 1,
|
||||||
'sortOrder' => 'default',
|
'sortOrder' => 'default',
|
||||||
'sortDirection' => false,
|
'sortDirection' => false,
|
||||||
'userID' => $this->userId
|
'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))
|
$map = [
|
||||||
->method('getUserValue')
|
[
|
||||||
->with(
|
$this->userId,
|
||||||
$this->equalTo($this->userId),
|
$this->appName,
|
||||||
$this->equalTo($this->appName),
|
'various_defaultCalendarId',
|
||||||
'various_showHidden'
|
'',
|
||||||
)
|
'personal'
|
||||||
->will($this->returnValue(0));
|
],
|
||||||
|
[
|
||||||
|
$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')
|
->method('getUserValue')
|
||||||
->with(
|
->will(
|
||||||
$this->equalTo($this->userId),
|
$this->returnValueMap($map)
|
||||||
$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));
|
|
||||||
|
|
||||||
$result = $this->settingsService->get();
|
$result = $this->settingsService->get();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue