From 1ceeb6815887299c7ba32b79e836df635da7382e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?= Date: Sat, 20 Jul 2019 10:15:14 +0200 Subject: [PATCH] =?UTF-8?q?Simplify=20SettingsService=20Test=20Signed-off-?= =?UTF-8?q?by:=20Raimund=20Schl=C3=BC=C3=9Fler=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/unit/Service/SettingsServiceTest.php | 69 +++++++++++----------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/tests/unit/Service/SettingsServiceTest.php b/tests/unit/Service/SettingsServiceTest.php index d8897ae6..9c772fa0 100644 --- a/tests/unit/Service/SettingsServiceTest.php +++ b/tests/unit/Service/SettingsServiceTest.php @@ -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();