@@ -78,7 +78,22 @@ protected function setUp(): void {
7878 );
7979 }
8080
81+ public function testGetUserTimezoneFromSettings (): void {
82+ $ this ->config ->expects (self ::once ())
83+ ->method ('getUserValue ' )
84+ ->with ('test123 ' , 'core ' , 'timezone ' , '' )
85+ ->willReturn ('Europe/Warsaw ' );
86+
87+ $ timezone = $ this ->service ->getUserTimezone ('test123 ' );
88+
89+ self ::assertSame ('Europe/Warsaw ' , $ timezone );
90+ }
91+
8192 public function testGetUserTimezoneFromAvailability (): void {
93+ $ this ->config ->expects (self ::once ())
94+ ->method ('getUserValue ' )
95+ ->with ('test123 ' , 'core ' , 'timezone ' , '' )
96+ ->willReturn ('' );
8297 $ property = new Property ();
8398 $ property ->setPropertyvalue ('BEGIN:VCALENDAR
8499PRODID:Nextcloud DAV app
@@ -99,10 +114,12 @@ public function testGetUserTimezoneFromAvailability(): void {
99114 }
100115
101116 public function testGetUserTimezoneFromPersonalCalendar (): void {
102- $ this ->config ->expects (self ::once ( ))
117+ $ this ->config ->expects (self ::exactly ( 2 ))
103118 ->method ('getUserValue ' )
104- ->with ('test123 ' , 'dav ' , 'defaultCalendar ' )
105- ->willReturn ('personal-1 ' );
119+ ->willReturnMap ([
120+ ['test123 ' , 'core ' , 'timezone ' , '' , '' ],
121+ ['test123 ' , 'dav ' , 'defaultCalendar ' , '' , 'personal-1 ' ],
122+ ]);
106123 $ other = $ this ->createMock (ICalendar::class);
107124 $ other ->method ('getUri ' )->willReturn ('other ' );
108125 $ personal = $ this ->createMock (CalendarImpl::class);
@@ -126,10 +143,12 @@ public function testGetUserTimezoneFromPersonalCalendar(): void {
126143 }
127144
128145 public function testGetUserTimezoneFromAny (): void {
129- $ this ->config ->expects (self ::once ( ))
146+ $ this ->config ->expects (self ::exactly ( 2 ))
130147 ->method ('getUserValue ' )
131- ->with ('test123 ' , 'dav ' , 'defaultCalendar ' )
132- ->willReturn ('personal-1 ' );
148+ ->willReturnMap ([
149+ ['test123 ' , 'core ' , 'timezone ' , '' , '' ],
150+ ['test123 ' , 'dav ' , 'defaultCalendar ' , '' , 'personal-1 ' ],
151+ ]);
133152 $ other = $ this ->createMock (ICalendar::class);
134153 $ other ->method ('getUri ' )->willReturn ('other ' );
135154 $ personal = $ this ->createMock (CalendarImpl::class);
0 commit comments