@@ -99,27 +99,23 @@ public function testGetOutOfOfficeDataInEffect(): void {
9999 $ this ->cache ->expects (self ::exactly (2 ))
100100 ->method ('get ' )
101101 ->willReturnOnConsecutiveCalls (null , null );
102- $ this ->absenceService ->expects (self ::once ())
103- ->method ('getAbsenceTimezone ' )
104- ->with ($ user ->getUID ())
105- ->willReturn ('UTC ' );
106102 $ this ->absenceService ->expects (self ::once ())
107103 ->method ('getAbsence ' )
108104 ->with ($ user ->getUID ())
109105 ->willReturn ($ absence );
110106 $ this ->cache ->expects (self ::exactly (2 ))
111107 ->method ('set ' )
112- ->withConsecutive ([$ user ->getUID () . '_timezone ' , 'UTC ' , 3600 ],
113- [$ user ->getUID (), '{"id":"420","startDate":1696118400 ,"endDate":1696809540 ,"shortMessage":"Vacation","message":"On vacation"} ' , 300 ]);
108+ ->withConsecutive ([$ user ->getUID () . '_timezone ' , 'Europe/Berlin ' , 3600 ],
109+ [$ user ->getUID (), '{"id":"420","startDate":1696111200 ,"endDate":1696802340 ,"shortMessage":"Vacation","message":"On vacation"} ' , 300 ]);
114110 $ this ->absenceService ->expects (self ::once ())
115111 ->method ('isInEffect ' )
116112 ->willReturn (true );
117113
118114 $ expected = new OutOfOfficeData (
119115 '420 ' ,
120116 $ user ,
121- 1696118400 ,
122- 1696809540 ,
117+ 1696111200 ,
118+ 1696802340 ,
123119 'Vacation ' ,
124120 'On vacation ' ,
125121 );
@@ -143,10 +139,9 @@ public function testGetOutOfOfficeDataNotInEffect(): void {
143139 $ this ->cache ->expects (self ::exactly (2 ))
144140 ->method ('get ' )
145141 ->willReturnOnConsecutiveCalls (null , null );
146- $ this ->absenceService ->expects (self ::once ())
147- ->method ('getAbsenceTimezone ' )
148- ->with ($ user ->getUID ())
149- ->willReturn ('UTC ' );
142+ $ this ->timezoneService ->expects (self ::once ())
143+ ->method ('getUserTimezone ' )
144+ ->willReturn ('Europe/Berlin ' );
150145 $ this ->absenceService ->expects (self ::once ())
151146 ->method ('getAbsence ' )
152147 ->with ($ user ->getUID ())
@@ -177,8 +172,6 @@ public function testGetOutOfOfficeDataCachedAll(): void {
177172 $ this ->cache ->expects (self ::exactly (2 ))
178173 ->method ('get ' )
179174 ->willReturnOnConsecutiveCalls ('UTC ' , '{"id":"420","startDate":1696118400,"endDate":1696809540,"shortMessage":"Vacation","message":"On vacation"} ' );
180- $ this ->absenceService ->expects (self ::never ())
181- ->method ('getAbsenceTimezone ' );
182175 $ this ->absenceService ->expects (self ::never ())
183176 ->method ('getAbsence ' );
184177 $ this ->cache ->expects (self ::exactly (1 ))
@@ -215,8 +208,6 @@ public function testGetOutOfOfficeDataNoData(): void {
215208 $ this ->cache ->expects (self ::exactly (2 ))
216209 ->method ('get ' )
217210 ->willReturnOnConsecutiveCalls ('UTC ' , null );
218- $ this ->absenceService ->expects (self ::never ())
219- ->method ('getAbsenceTimezone ' );
220211 $ this ->absenceService ->expects (self ::once ())
221212 ->method ('getAbsence ' )
222213 ->willReturn (null );
@@ -246,15 +237,13 @@ public function testGetOutOfOfficeDataWithInvalidCachedData(): void {
246237 $ this ->cache ->expects (self ::exactly (2 ))
247238 ->method ('get ' )
248239 ->willReturnOnConsecutiveCalls ('UTC ' , '{"id":"420",} ' );
249- $ this ->absenceService ->expects (self ::never ())
250- ->method ('getAbsenceTimezone ' );
251240 $ this ->absenceService ->expects (self ::once ())
252241 ->method ('getAbsence ' )
253242 ->with ('user ' )
254243 ->willReturn ($ absence );
255244 $ this ->cache ->expects (self ::once ())
256245 ->method ('set ' )
257- ->with ('user ' , '{"id":"420","startDate":1696111200,"endDate":1696802340,"shortMessage":"Vacation","message":"On vacation"} ' , 300 );
246+ // ->with('user', '{"id":"420","startDate":1696111200,"endDate":1696802340,"shortMessage":"Vacation","message":"On vacation"}', 300);
258247 ->with ('user ' , '{"id":"420","startDate":1696118400,"endDate":1696809540,"shortMessage":"Vacation","message":"On vacation"} ' , 300 );
259248 $ this ->absenceService ->expects (self ::once ())
260249 ->method ('isInEffect ' )
0 commit comments