From 43aba3b36fc4c82c1c786766025a02995843d51b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Zi=C3=83=C2=B3=C3=85=E2=80=9Akowski?= Date: Mon, 11 Apr 2022 10:12:56 +0000 Subject: [PATCH] Tests: Improve code comments for block supports tests Follow-up for [53085]. Props ramonopoly, antonvlasenko, peterwilsoncc. See #55505. git-svn-id: https://develop.svn.wordpress.org/trunk@53128 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/block-supports/border.php | 7 ++++- tests/phpunit/tests/block-supports/colors.php | 10 ++++++- .../phpunit/tests/block-supports/elements.php | 9 ++++++ tests/phpunit/tests/block-supports/layout.php | 8 ++++++ .../phpunit/tests/block-supports/spacing.php | 7 ++++- .../tests/block-supports/typography.php | 28 ++++++++++++++++--- 6 files changed, 62 insertions(+), 7 deletions(-) diff --git a/tests/phpunit/tests/block-supports/border.php b/tests/phpunit/tests/block-supports/border.php index 5a0f134b65ef4..c00715c16c1d6 100644 --- a/tests/phpunit/tests/block-supports/border.php +++ b/tests/phpunit/tests/block-supports/border.php @@ -3,9 +3,10 @@ * @group block-supports */ class Test_Block_Supports_Border extends WP_UnitTestCase { - /** * @ticket 55505 + * + * @covers ::wp_apply_border_support */ function test_border_color_slug_with_numbers_is_kebab_cased_properly() { $block_name = 'test/border-color-slug-with-numbers-is-kebab-cased-properly'; @@ -56,6 +57,8 @@ function test_border_color_slug_with_numbers_is_kebab_cased_properly() { /** * @ticket 55505 + * + * @covers ::wp_apply_border_support */ function test_border_with_skipped_serialization_block_supports() { $block_name = 'test/border-with-skipped-serialization-block-supports'; @@ -101,6 +104,8 @@ function test_border_with_skipped_serialization_block_supports() { /** * @ticket 55505 + * + * @covers ::wp_apply_border_support */ function test_radius_with_individual_skipped_serialization_block_supports() { $block_name = 'test/radius-with-individual-skipped-serialization-block-supports'; diff --git a/tests/phpunit/tests/block-supports/colors.php b/tests/phpunit/tests/block-supports/colors.php index f88eb6865eaf5..49a3f5cc218ac 100644 --- a/tests/phpunit/tests/block-supports/colors.php +++ b/tests/phpunit/tests/block-supports/colors.php @@ -3,7 +3,11 @@ * @group block-supports */ class Tests_Block_Supports_Colors extends WP_UnitTestCase { - + /** + * @ticket 54337 + * + * @covers ::wp_apply_colors_support + */ function test_color_slugs_with_numbers_are_kebab_cased_properly() { register_block_type( 'test/color-slug-with-numbers', @@ -47,6 +51,8 @@ function test_color_slugs_with_numbers_are_kebab_cased_properly() { /** * @ticket 55505 + * + * @covers ::wp_apply_colors_support */ function test_color_with_skipped_serialization_block_supports() { $block_name = 'test/color-with-skipped-serialization-block-supports'; @@ -89,6 +95,8 @@ function test_color_with_skipped_serialization_block_supports() { /** * @ticket 55505 + * + * @covers ::wp_apply_colors_support */ function test_gradient_with_individual_skipped_serialization_block_supports() { $block_name = 'test/gradient-with-individual-skipped-serialization-block-support'; diff --git a/tests/phpunit/tests/block-supports/elements.php b/tests/phpunit/tests/block-supports/elements.php index ae524ac7679d9..e80ed4d8f41cf 100644 --- a/tests/phpunit/tests/block-supports/elements.php +++ b/tests/phpunit/tests/block-supports/elements.php @@ -16,6 +16,9 @@ private static function make_unique_id_one( $string ) { /** * Test wp_render_elements_support() with a simple paragraph and link color preset. + * @ticket 54337 + * + * @covers ::wp_render_elements_support */ public function test_simple_paragraph_link_color() { $result = self::make_unique_id_one( @@ -45,6 +48,9 @@ public function test_simple_paragraph_link_color() { /** * Test wp_render_elements_support() with a paragraph containing a class. + * @ticket 54337 + * + * @covers ::wp_render_elements_support */ public function test_class_paragraph_link_color() { $result = self::make_unique_id_one( @@ -75,6 +81,9 @@ public function test_class_paragraph_link_color() { /** * Test wp_render_elements_support() with a paragraph containing a anchor. + * @ticket 54337 + * + * @covers ::wp_render_elements_support */ public function test_anchor_paragraph_link_color() { $result = self::make_unique_id_one( diff --git a/tests/phpunit/tests/block-supports/layout.php b/tests/phpunit/tests/block-supports/layout.php index 27d30ed2bbb78..6ddd6feaee348 100644 --- a/tests/phpunit/tests/block-supports/layout.php +++ b/tests/phpunit/tests/block-supports/layout.php @@ -53,6 +53,8 @@ function filter_set_theme_root() { /** * @ticket 55505 + * + * @covers ::wp_restore_image_outer_container */ function test_outer_container_not_restored_for_non_aligned_image_block_with_non_themejson_theme() { // The "default" theme doesn't have theme.json support. @@ -69,6 +71,8 @@ function test_outer_container_not_restored_for_non_aligned_image_block_with_non_ /** * @ticket 55505 + * + * @covers ::wp_restore_image_outer_container */ function test_outer_container_restored_for_aligned_image_block_with_non_themejson_theme() { // The "default" theme doesn't have theme.json support. @@ -86,6 +90,8 @@ function test_outer_container_restored_for_aligned_image_block_with_non_themejso /** * @ticket 55505 * + * @covers ::wp_restore_image_outer_container + * * @dataProvider data_block_image_html_restored_outer_container * * @param string $block_image_html The block image HTML passed to `wp_restore_image_outer_container`. @@ -143,6 +149,8 @@ public function data_block_image_html_restored_outer_container() { /** * @ticket 55505 + * + * @covers ::wp_restore_image_outer_container */ function test_outer_container_not_restored_for_aligned_image_block_with_themejson_theme() { switch_theme( 'block-theme' ); diff --git a/tests/phpunit/tests/block-supports/spacing.php b/tests/phpunit/tests/block-supports/spacing.php index 9550f39da80b5..7c20f07a6b0a3 100644 --- a/tests/phpunit/tests/block-supports/spacing.php +++ b/tests/phpunit/tests/block-supports/spacing.php @@ -3,9 +3,10 @@ * @group block-supports */ class Test_Block_Supports_Spacing extends WP_UnitTestCase { - /** * @ticket 55505 + * + * @covers ::wp_apply_spacing_support */ function test_spacing_style_is_applied() { $block_name = 'test/spacing-style-is-applied'; @@ -55,6 +56,8 @@ function test_spacing_style_is_applied() { /** * @ticket 55505 + * + * @covers ::wp_apply_spacing_support */ function test_spacing_with_skipped_serialization_block_supports() { $block_name = 'test/spacing-with-skipped-serialization-block-supports'; @@ -103,6 +106,8 @@ function test_spacing_with_skipped_serialization_block_supports() { /** * @ticket 55505 + * + * @covers ::wp_apply_spacing_support */ function test_margin_with_individual_skipped_serialization_block_supports() { $block_name = 'test/margin-with-individual-skipped-serialization-block-supports'; diff --git a/tests/phpunit/tests/block-supports/typography.php b/tests/phpunit/tests/block-supports/typography.php index 0cb9f49c820df..2dd3920553102 100644 --- a/tests/phpunit/tests/block-supports/typography.php +++ b/tests/phpunit/tests/block-supports/typography.php @@ -3,7 +3,11 @@ * @group block-supports */ class Tests_Block_Supports_Typography extends WP_UnitTestCase { - + /** + * @ticket 54337 + * + * @covers ::wp_apply_typography_support + */ function test_font_size_slug_with_numbers_is_kebab_cased_properly() { register_block_type( 'test/font-size-slug-with-numbers', @@ -32,7 +36,11 @@ function test_font_size_slug_with_numbers_is_kebab_cased_properly() { $this->assertSame( $expected, $actual ); unregister_block_type( 'test/font-size-slug-with-numbers' ); } - + /** + * @ticket 54337 + * + * @covers ::wp_apply_typography_support + */ function test_font_family_with_legacy_inline_styles_using_a_value() { $block_name = 'test/font-family-with-inline-styles-using-value'; register_block_type( @@ -64,6 +72,8 @@ function test_font_family_with_legacy_inline_styles_using_a_value() { /** * @ticket 55505 + * + * @covers ::wp_apply_typography_support */ function test_typography_with_skipped_serialization_block_supports() { $block_name = 'test/typography-with-skipped-serialization-block-supports'; @@ -109,6 +119,8 @@ function test_typography_with_skipped_serialization_block_supports() { /** * @ticket 55505 + * + * @covers ::wp_apply_typography_support */ function test_letter_spacing_with_individual_skipped_serialization_block_supports() { $block_name = 'test/letter-spacing-with-individua-skipped-serialization-block-supports'; @@ -141,7 +153,11 @@ function test_letter_spacing_with_individual_skipped_serialization_block_support $this->assertSame( $expected, $actual ); unregister_block_type( $block_name ); } - + /** + * @ticket 54337 + * + * @covers ::wp_apply_typography_support + */ function test_font_family_with_legacy_inline_styles_using_a_css_var() { $block_name = 'test/font-family-with-inline-styles-using-css-var'; register_block_type( @@ -170,7 +186,11 @@ function test_font_family_with_legacy_inline_styles_using_a_css_var() { $this->assertSame( $expected, $actual ); unregister_block_type( $block_name ); } - + /** + * @ticket 54337 + * + * @covers ::wp_apply_typography_support + */ function test_font_family_with_class() { $block_name = 'test/font-family-with-class'; register_block_type(