@@ -256,6 +256,7 @@ public function testBindListData_kvpList_object():void {
256
256
}
257
257
}
258
258
259
+ /** @noinspection PhpUnused */
259
260
public function testBindListData_kvpList_instanceObject ():void {
260
261
$ kvpList = [
261
262
new class { public int $ userId = 543 ; public string $ username = "win95 " ; public int $ orderCount = 55 ; },
@@ -284,46 +285,56 @@ public function testBindListData_kvpList_instanceObject():void {
284
285
public function testBindListData_kvpList_instanceObjectWithBindAttributeMethods ():void {
285
286
$ kvpList = [
286
287
new class {
288
+ /** @noinspection PhpUnused */
287
289
#[Bind("userId " )]
288
290
public function getId ():int {
289
291
return 534 ;
290
292
}
293
+ /** @noinspection PhpUnused */
291
294
#[Bind("username " )]
292
295
public function getUsername ():string {
293
296
return "win95 " ;
294
297
}
298
+ /** @noinspection PhpUnused */
295
299
#[Bind("this-matches-nothing " )]
296
300
public function getNothing ():string {
297
301
return "nothing! " ;
298
302
}
303
+ /** @noinspection PhpUnused */
299
304
#[Bind("orderCount " )]
300
305
public function getTotalOrders ():int {
301
306
return 55 ;
302
307
}
303
308
},
304
309
new class {
310
+ /** @noinspection PhpUnused */
305
311
#[Bind("userId " )]
306
312
public function getId ():int {
307
313
return 559 ;
308
314
}
315
+ /** @noinspection PhpUnused */
309
316
#[Bind("username " )]
310
317
public function getUsername ():string {
311
318
return "seafoam " ;
312
319
}
320
+ /** @noinspection PhpUnused */
313
321
#[Bind("orderCount " )]
314
322
public function getTotalOrders ():int {
315
323
return 30 ;
316
324
}
317
325
},
318
326
new class {
327
+ /** @noinspection PhpUnused */
319
328
#[Bind("userId " )]
320
329
public function getId ():int {
321
330
return 274 ;
322
331
}
332
+ /** @noinspection PhpUnused */
323
333
#[Bind("username " )]
324
334
public function getUsername ():string {
325
335
return "hammatime " ;
326
336
}
337
+ /** @noinspection PhpUnused */
327
338
#[Bind("orderCount " )]
328
339
public function getTotalOrders ():int {
329
340
return 23 ;
@@ -343,13 +354,13 @@ public function getTotalOrders():int {
343
354
$ sut ->bindListData ($ kvpList , $ orderList );
344
355
345
356
foreach ($ orderList ->children as $ i => $ li ) {
346
- /** @var HTMLLiElement $li */
347
357
self ::assertEquals ($ kvpList [$ i ]->getId (), $ li ->querySelector ("h3 span " )->textContent );
348
358
self ::assertEquals ($ kvpList [$ i ]->getUsername (), $ li ->querySelector ("h2 span " )->textContent );
349
359
self ::assertEquals ($ kvpList [$ i ]->getTotalOrders (), $ li ->querySelector ("p span " )->textContent );
350
360
}
351
361
}
352
362
363
+ /** @noinspection PhpUnused */
353
364
public function testBindListData_kvpList_instanceObjectWithBindAttributeProperties ():void {
354
365
$ kvpList = [
355
366
new class {
@@ -399,7 +410,6 @@ public function testBindListData_kvpList_instanceObjectWithBindAttributeProperti
399
410
$ sut ->bindListData ($ kvpList , $ orderList );
400
411
401
412
foreach ($ orderList ->children as $ i => $ li ) {
402
- /** @var HTMLLiElement $li */
403
413
self ::assertEquals ($ kvpList [$ i ]->id , $ li ->querySelector ("h3 span " )->textContent );
404
414
self ::assertEquals ($ kvpList [$ i ]->user , $ li ->querySelector ("h2 span " )->textContent );
405
415
self ::assertEquals ($ kvpList [$ i ]->totalOrders , $ li ->querySelector ("p span " )->textContent );
@@ -492,7 +502,7 @@ public function testBindListData_dateTime():void {
492
502
493
503
while ($ dateTime ->format ("Y " ) === $ currentYear ) {
494
504
array_push ($ listData , new class (clone $ dateTime ) implements Stringable {
495
- public function __construct (private DateTime $ dateTime ) {}
505
+ public function __construct (private readonly DateTime $ dateTime ) {}
496
506
public function __toString ():string {
497
507
return $ this ->dateTime ->format ("F: l " );
498
508
}
@@ -517,7 +527,6 @@ public function testBindListData_todoList():void {
517
527
518
528
$ todoLiElements = $ document ->querySelectorAll ("ul>li " );
519
529
foreach ($ data as $ i => $ todoItem ) {
520
- /** @var HTMLLiElement $li */
521
530
$ li = $ todoLiElements [$ i ];
522
531
self ::assertEquals ($ todoItem ["id " ], $ li ->querySelector ("[name=id] " )->value );
523
532
self ::assertEquals ($ todoItem ["title " ], $ li ->querySelector ("[name=title] " )->value );
@@ -551,6 +560,7 @@ public function testBindListData_multipleTemplateSiblings():void {
551
560
}
552
561
}
553
562
563
+ /** @noinspection PhpUnusedParameterInspection */
554
564
public function testBindListData_callback ():void {
555
565
$ salesData = [
556
566
[
@@ -595,27 +605,4 @@ public function testBindListData_callback():void {
595
605
self ::assertEquals ($ profitValue , $ li ->querySelector (".profit span " )->textContent );
596
606
}
597
607
}
598
-
599
- public function testBindList_twoListsSeparatedByElement ():void {
600
- $ blueShades = ["Periwinkle " , "Ultramarine " , "Liberty " , "Navy " , "Blurple " ];
601
- $ redShades = ["Brink pink " , "Crimson " , "Vermilion " , "Scarlet " ];
602
- $ document = new HTMLDocument (DocumentTestFactory::HTML_TWO_SUB_LISTS_SEPARATED_BY_ELEMENT );
603
- $ templateCollection = new TemplateCollection ($ document );
604
- $ sut = new ListBinder ($ templateCollection );
605
- $ sut ->bindListData ($ redShades , $ document , "red " );
606
- $ sut ->bindListData ($ blueShades , $ document , "blue " );
607
-
608
- $ dtElements = $ document ->querySelectorAll ("dt " );
609
- $ context = $ dtElements [0 ]->nextElementSibling ;
610
- for ($ i = 0 ; $ i < count ($ blueShades ); $ i ++) {
611
- self ::assertEquals ($ blueShades [$ i ], $ context ->textContent );
612
- $ context = $ context ->nextElementSibling ;
613
- }
614
-
615
- $ context = $ dtElements [1 ]->nextElementSibling ;
616
- for ($ i = 0 ; $ i < count ($ redShades ); $ i ++) {
617
- self ::assertEquals ($ redShades [$ i ], $ context ->textContent );
618
- $ context = $ context ->nextElementSibling ;
619
- }
620
- }
621
608
}
0 commit comments