@@ -114,53 +114,56 @@ public function testGetBookableSlots(): void {
114114
115115 $ apptConfg = new AppointmentConfig ();
116116 $ apptConfg ->setId (1 );
117+ $ apptConfg ->setToken ('abc123 ' );
117118 $ this ->time ->expects (self ::once ())
118119 ->method ('getTime ' )
119120 ->willReturn ($ currentDate );
120121 $ this ->apptService ->expects (self ::once ())
121- ->method ('findById ' )
122- ->with (1 )
122+ ->method ('findByToken ' )
123+ ->with ($ apptConfg -> getToken () )
123124 ->willReturn ($ apptConfg );
124125 $ this ->bookingService ->expects (self ::once ())
125126 ->method ('getAvailableSlots ' )
126127 ->with ($ apptConfg , $ sDT , $ eDT );
127128
128- $ this ->controller ->getBookableSlots ($ apptConfg ->getId (), $ selectedDate , $ selectedTz );
129+ $ this ->controller ->getBookableSlots ($ apptConfg ->getToken (), $ selectedDate , $ selectedTz );
129130 }
130131
131132 public function testGetBookableSlotsDatesInPast (): void {
132133 $ currentDate = (new DateTime ('2024-7-2 ' ))->getTimestamp ();
133134 $ selectedDate = '2024-7-1 ' ;
134135 $ apptConfg = new AppointmentConfig ();
135136 $ apptConfg ->setId (1 );
137+ $ apptConfg ->setToken ('abc123 ' );
136138 $ this ->time ->expects (self ::once ())
137139 ->method ('getTime ' )
138140 ->willReturn ($ currentDate );
139141 $ this ->apptService ->expects (self ::never ())
140- ->method ('findById ' )
141- ->with (1 );
142+ ->method ('findByToken ' )
143+ ->with ($ apptConfg -> getToken () );
142144 $ this ->bookingService ->expects (self ::never ())
143145 ->method ('getAvailableSlots ' );
144146 $ this ->logger ->expects (self ::once ())
145147 ->method ('warning ' );
146148
147- $ this ->controller ->getBookableSlots ($ apptConfg ->getId (), $ selectedDate , 'Europe/Berlin ' );
149+ $ this ->controller ->getBookableSlots ($ apptConfg ->getToken (), $ selectedDate , 'Europe/Berlin ' );
148150 }
149151
150152 public function testGetBookableSlotsInvalidTimezone (): void {
151153 $ selectedDate = '2024-7-1 ' ;
152154 $ apptConfg = new AppointmentConfig ();
153155 $ apptConfg ->setId (1 );
156+ $ apptConfg ->setToken ('abc123 ' );
154157 $ this ->time ->expects (self ::never ())
155158 ->method ('getTime ' );
156159 $ this ->apptService ->expects (self ::never ())
157- ->method ('findById ' )
158- ->with (1 );
160+ ->method ('findByToken ' )
161+ ->with ($ apptConfg -> getToken () );
159162 $ this ->bookingService ->expects (self ::never ())
160163 ->method ('getAvailableSlots ' );
161164 $ this ->expectException (Exception::class);
162165
163- $ this ->controller ->getBookableSlots ($ apptConfg ->getId (), $ selectedDate , 'Hook/Neverland ' );
166+ $ this ->controller ->getBookableSlots ($ apptConfg ->getToken (), $ selectedDate , 'Hook/Neverland ' );
164167 }
165168
166169 public function testGetBookableSlotsTimezoneIdentical (): void {
@@ -173,18 +176,19 @@ public function testGetBookableSlotsTimezoneIdentical(): void {
173176
174177 $ apptConfg = new AppointmentConfig ();
175178 $ apptConfg ->setId (1 );
179+ $ apptConfg ->setToken ('abc123 ' );
176180 $ this ->time ->expects (self ::once ())
177181 ->method ('getTime ' )
178182 ->willReturn ($ currentDate );
179183 $ this ->apptService ->expects (self ::once ())
180- ->method ('findById ' )
181- ->with (1 )
184+ ->method ('findByToken ' )
185+ ->with ($ apptConfg -> getToken () )
182186 ->willReturn ($ apptConfg );
183187 $ this ->bookingService ->expects (self ::once ())
184188 ->method ('getAvailableSlots ' )
185189 ->with ($ apptConfg , $ sDT , $ eDT );
186190
187- $ this ->controller ->getBookableSlots ($ apptConfg ->getId (), $ selectedDate , $ selectedTz );
191+ $ this ->controller ->getBookableSlots ($ apptConfg ->getToken (), $ selectedDate , $ selectedTz );
188192 }
189193
190194 public function testGetBookableSlotsTimezoneMinus10 (): void {
@@ -197,18 +201,19 @@ public function testGetBookableSlotsTimezoneMinus10(): void {
197201
198202 $ apptConfg = new AppointmentConfig ();
199203 $ apptConfg ->setId (1 );
204+ $ apptConfg ->setToken ('abc123 ' );
200205 $ this ->time ->expects (self ::once ())
201206 ->method ('getTime ' )
202207 ->willReturn ($ currentDate );
203208 $ this ->apptService ->expects (self ::once ())
204- ->method ('findById ' )
205- ->with (1 )
209+ ->method ('findByToken ' )
210+ ->with ($ apptConfg -> getToken () )
206211 ->willReturn ($ apptConfg );
207212 $ this ->bookingService ->expects (self ::once ())
208213 ->method ('getAvailableSlots ' )
209214 ->with ($ apptConfg , $ sDT , $ eDT );
210215
211- $ this ->controller ->getBookableSlots ($ apptConfg ->getId (), $ selectedDate , $ timezone );
216+ $ this ->controller ->getBookableSlots ($ apptConfg ->getToken (), $ selectedDate , $ timezone );
212217 }
213218
214219 public function testGetBookableSlotsTimezonePlus10 (): void {
@@ -221,18 +226,19 @@ public function testGetBookableSlotsTimezonePlus10(): void {
221226
222227 $ apptConfg = new AppointmentConfig ();
223228 $ apptConfg ->setId (1 );
229+ $ apptConfg ->setToken ('abc123 ' );
224230 $ this ->time ->expects (self ::once ())
225231 ->method ('getTime ' )
226232 ->willReturn ($ currentDate );
227233 $ this ->apptService ->expects (self ::once ())
228- ->method ('findById ' )
229- ->with (1 )
234+ ->method ('findByToken ' )
235+ ->with ($ apptConfg -> getToken () )
230236 ->willReturn ($ apptConfg );
231237 $ this ->bookingService ->expects (self ::once ())
232238 ->method ('getAvailableSlots ' )
233239 ->with ($ apptConfg , $ sDT , $ eDT );
234240
235- $ this ->controller ->getBookableSlots ($ apptConfg ->getId (), $ selectedDate , $ timezone );
241+ $ this ->controller ->getBookableSlots ($ apptConfg ->getToken (), $ selectedDate , $ timezone );
236242 }
237243
238244 public function testGetBookableSlotsTimezonePlus14 (): void {
@@ -245,18 +251,19 @@ public function testGetBookableSlotsTimezonePlus14(): void {
245251
246252 $ apptConfg = new AppointmentConfig ();
247253 $ apptConfg ->setId (1 );
254+ $ apptConfg ->setToken ('abc123 ' );
248255 $ this ->time ->expects (self ::once ())
249256 ->method ('getTime ' )
250257 ->willReturn ($ currentDate );
251258 $ this ->apptService ->expects (self ::once ())
252- ->method ('findById ' )
253- ->with (1 )
259+ ->method ('findByToken ' )
260+ ->with ($ apptConfg -> getToken () )
254261 ->willReturn ($ apptConfg );
255262 $ this ->bookingService ->expects (self ::once ())
256263 ->method ('getAvailableSlots ' )
257264 ->with ($ apptConfg , $ sDT , $ eDT );
258265
259- $ this ->controller ->getBookableSlots ($ apptConfg ->getId (), $ selectedDate , $ timezone );
266+ $ this ->controller ->getBookableSlots ($ apptConfg ->getToken (), $ selectedDate , $ timezone );
260267 }
261268
262269 public function testBook (): void {
@@ -268,14 +275,14 @@ public function testBook(): void {
268275 ->with ($ email )
269276 ->willReturn (true );
270277 $ this ->apptService ->expects (self ::once ())
271- ->method ('findById ' )
278+ ->method ('findByToken ' )
272279 ->willReturn ($ config );
273280 $ this ->bookingService ->expects (self ::once ())
274281 ->method ('book ' )
275282 ->with ($ config , 1 , 1 , 'Hook/Neverland ' , 'Test ' , $ email , 'Test ' )
276283 ->willReturn (new Booking ());
277284
278- $ this ->controller ->bookSlot (1 , 1 , 1 , 'Test ' , $ email , 'Test ' , 'Hook/Neverland ' );
285+ $ this ->controller ->bookSlot (' abc123 ' , 1 , 1 , 'Test ' , $ email , 'Test ' , 'Hook/Neverland ' );
279286 }
280287
281288
@@ -288,14 +295,14 @@ public function testBookInvalidTimeZone(): void {
288295 ->with ($ email )
289296 ->willReturn (true );
290297 $ this ->apptService ->expects (self ::once ())
291- ->method ('findById ' )
298+ ->method ('findByToken ' )
292299 ->willReturn ($ config );
293300 $ this ->bookingService ->expects (self ::once ())
294301 ->method ('book ' )
295302 ->with ($ config , 1 , 1 , 'Hook/Neverland ' , 'Test ' , $ email , 'Test ' )
296303 ->willThrowException (new InvalidArgumentException ());
297304
298- $ this ->controller ->bookSlot (1 , 1 , 1 , 'Test ' , $ email , 'Test ' , 'Hook/Neverland ' );
305+ $ this ->controller ->bookSlot (' abc123 ' , 1 , 1 , 'Test ' , $ email , 'Test ' , 'Hook/Neverland ' );
299306 }
300307
301308 public function testBookInvalidSlot (): void {
@@ -307,14 +314,14 @@ public function testBookInvalidSlot(): void {
307314 ->with ($ email )
308315 ->willReturn (true );
309316 $ this ->apptService ->expects (self ::once ())
310- ->method ('findById ' )
317+ ->method ('findByToken ' )
311318 ->willReturn ($ config );
312319 $ this ->bookingService ->expects (self ::once ())
313320 ->method ('book ' )
314321 ->with ($ config , 1 , 1 , 'Europe/Berlin ' , 'Test ' , $ email , 'Test ' )
315322 ->willThrowException (new NoSlotFoundException ());
316323
317- $ this ->controller ->bookSlot (1 , 1 , 1 , 'Test ' , $ email , 'Test ' , 'Europe/Berlin ' );
324+ $ this ->controller ->bookSlot (' abc123 ' , 1 , 1 , 'Test ' , $ email , 'Test ' , 'Europe/Berlin ' );
318325 }
319326
320327 public function testBookInvalidBooking (): void {
@@ -326,7 +333,7 @@ public function testBookInvalidBooking(): void {
326333 ->with ($ email )
327334 ->willReturn (true );
328335 $ this ->apptService ->expects (self ::once ())
329- ->method ('findById ' )
336+ ->method ('findByToken ' )
330337 ->willReturn ($ config );
331338 $ this ->bookingService ->expects (self ::once ())
332339 ->method ('book ' )
@@ -337,7 +344,7 @@ public function testBookInvalidBooking(): void {
337344 ->with ('debug ' )
338345 ->willReturn (false );
339346
340- $ this ->controller ->bookSlot (1 , 1 , 1 , 'Test ' , $ email , 'Test ' , 'Europe/Berlin ' );
347+ $ this ->controller ->bookSlot (' abc123 ' , 1 , 1 , 'Test ' , $ email , 'Test ' , 'Europe/Berlin ' );
341348 }
342349
343350 public function testBookInvalidId (): void {
@@ -347,12 +354,12 @@ public function testBookInvalidId(): void {
347354 ->with ($ email )
348355 ->willReturn (true );
349356 $ this ->apptService ->expects (self ::once ())
350- ->method ('findById ' )
357+ ->method ('findByToken ' )
351358 ->willThrowException (new ServiceException ());
352359 $ this ->bookingService ->expects (self ::never ())
353360 ->method ('book ' );
354361
355- $ this ->controller ->bookSlot (1 , 1 , 1 , 'Test ' , $ email , 'Test ' , 'Europe/Berlin ' );
362+ $ this ->controller ->bookSlot (' abc123 ' , 1 , 1 , 'Test ' , $ email , 'Test ' , 'Europe/Berlin ' );
356363 }
357364
358365
@@ -364,10 +371,10 @@ public function testBookInvalidEmail(): void {
364371 ->with ($ email )
365372 ->willReturn (false );
366373 $ this ->apptService ->expects (self ::never ())
367- ->method ('findById ' );
374+ ->method ('findByToken ' );
368375 $ this ->bookingService ->expects (self ::never ())
369376 ->method ('book ' );
370377
371- $ this ->controller ->bookSlot (1 , 1 , 1 , 'Test ' , $ email , 'Test ' , 'Europe/Berlin ' );
378+ $ this ->controller ->bookSlot (' abc123 ' , 1 , 1 , 'Test ' , $ email , 'Test ' , 'Europe/Berlin ' );
372379 }
373380}
0 commit comments