Skip to content

Commit de106d9

Browse files
Add unit test coverage for auto_sizes_get_featured_image_attachment_id()
1 parent 1aff570 commit de106d9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

plugins/auto-sizes/tests/test-improve-calculate-sizes.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,6 +1487,19 @@ public static function data_post_featured_image_block_alignment(): array {
14871487
);
14881488
}
14891489

1490+
/**
1491+
* Test that auto_sizes_get_featured_image_attachment_id() returns 0 when post_id is not found.
1492+
*
1493+
* @covers ::auto_sizes_get_featured_image_attachment_id
1494+
*/
1495+
public function test_auto_sizes_get_featured_image_attachment_id_returns_zero_for_zero_post_id(): void {
1496+
$this->assertSame(
1497+
0,
1498+
auto_sizes_get_featured_image_attachment_id( 0 ),
1499+
'Should return 0 when post_id is not found.'
1500+
);
1501+
}
1502+
14901503
/**
14911504
* Filter the theme.json data to include relative layout sizes.
14921505
*

0 commit comments

Comments
 (0)