@@ -346,12 +346,6 @@ public function data_provider_for_auto_sizes_update_image_attributes(): array {
346
346
'sizes ' => 'auto, 100vw ' ,
347
347
),
348
348
),
349
-
350
- // Test when $attr is not an array.
351
- array (
352
- 'attr ' => array (),
353
- 'expected ' => array (),
354
- ),
355
349
);
356
350
}
357
351
@@ -366,4 +360,31 @@ public function data_provider_for_auto_sizes_update_image_attributes(): array {
366
360
public function test_auto_sizes_update_image_attributes ( array $ attr , array $ expected ): void {
367
361
$ this ->assertSame ( $ expected , auto_sizes_update_image_attributes ( $ attr ) );
368
362
}
363
+
364
+ /**
365
+ * @covers ::auto_sizes_update_content_img_tag
366
+ */
367
+ public function test_auto_sizes_update_content_img_tag_non_string_input (): void {
368
+ /*
369
+ These tests are separate from the data provider approach because the function
370
+ auto_sizes_update_content_img_tag() expects a string as an argument. Passing a non-string
371
+ value would cause a TypeError. These tests ensure that the function behaves as expected
372
+ when it receives non-string inputs.
373
+ */
374
+ $ this ->assertSame ( '' , auto_sizes_update_content_img_tag ( array () ) );
375
+ }
376
+
377
+ /**
378
+ * @covers ::auto_sizes_update_image_attributes
379
+ */
380
+ public function test_auto_sizes_update_image_attributes_with_null_input (): void {
381
+ /*
382
+ This test is separate because the main test method uses a data provider
383
+ that expects the $attr parameter to be an array. Passing null directly
384
+ would cause a TypeError due to the type hint. By testing null separately,
385
+ we ensure that the function can handle null inputs gracefully without
386
+ modifying the type hint in the main test method.
387
+ */
388
+ $ this ->assertSame ( array (), auto_sizes_update_image_attributes ( null ) );
389
+ }
369
390
}
0 commit comments