From 22c854485b9e25cd342575ce3dffe34f794dfc56 Mon Sep 17 00:00:00 2001 From: MaggieCabrera Date: Fri, 16 Jun 2023 11:21:05 +0200 Subject: [PATCH] added docs or fixed them --- src/wp-includes/block-supports/duotone.php | 2 -- src/wp-includes/class-wp-duotone.php | 4 ++-- tests/phpunit/tests/block-supports/duotone.php | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/block-supports/duotone.php b/src/wp-includes/block-supports/duotone.php index e291564a3dee0..677fdfe0cbc57 100644 --- a/src/wp-includes/block-supports/duotone.php +++ b/src/wp-includes/block-supports/duotone.php @@ -481,8 +481,6 @@ function wp_register_duotone_support( $block_type ) { * @since 6.1.0 Allow unset for preset colors. * @access private * - * @deprecated 6.3.0 Use WP_Duotone::render_duotone_support() instead. - * * @param string $block_content Rendered block content. * @param array $block Block object. * @deprecated 6.3.0 Use WP_Duotone::render_duotone_support() instead. diff --git a/src/wp-includes/class-wp-duotone.php b/src/wp-includes/class-wp-duotone.php index 031d299e9ac7a..7a4da5a137a93 100644 --- a/src/wp-includes/class-wp-duotone.php +++ b/src/wp-includes/class-wp-duotone.php @@ -444,7 +444,7 @@ private static function colord_parse( $input ) { } /** - * Take the inline CSS duotone variable from a block and return the slug. Handles styles slugs like: + * Takes the inline CSS duotone variable from a block and return the slug. Handles styles slugs like: * var:preset|duotone|blue-orange * var(--wp--preset--duotone--blue-orange) * @@ -459,7 +459,7 @@ private static function get_slug_from_attribute( $duotone_attr ) { } /** - * Check if we have a valid duotone preset. + * Checks if we have a valid duotone preset. * * @param string $duotone_attr The duotone attribute from a block. * @return bool True if the duotone preset present and valid. diff --git a/tests/phpunit/tests/block-supports/duotone.php b/tests/phpunit/tests/block-supports/duotone.php index b7f61493ec182..7059693986dfa 100644 --- a/tests/phpunit/tests/block-supports/duotone.php +++ b/tests/phpunit/tests/block-supports/duotone.php @@ -15,6 +15,11 @@ public static function wpTearDownAfterClass() { WP_Style_Engine_CSS_Rules_Store::remove_all_stores(); } + /** + * Tests whether the duotone preset class is added to the block. + * + * @covers ::render_duotone_support + */ public function test_render_duotone_support_preset() { $block = array( 'blockName' => 'core/image', @@ -25,6 +30,11 @@ public function test_render_duotone_support_preset() { $this->assertSame( $expected, WP_Duotone::render_duotone_support( $block_content, $block ) ); } + /** + * Tests whether the duotone unset class is added to the block. + * + * @covers ::render_duotone_support + */ public function test_render_duotone_support_css() { $block = array( 'blockName' => 'core/image', @@ -35,6 +45,11 @@ public function test_render_duotone_support_css() { $this->assertMatchesRegularExpression( $expected, WP_Duotone::render_duotone_support( $block_content, $block ) ); } + /** + * Tests whether the duotone custom class is added to the block. + * + * @covers ::render_duotone_support + */ public function test_render_duotone_support_custom() { $block = array( 'blockName' => 'core/image', @@ -60,7 +75,10 @@ public function data_get_slug_from_attribute() { } /** + * Tests whether the slug is extracted from the attribute. + * * @dataProvider data_get_slug_from_attribute + * @covers ::get_slug_from_attribute */ public function test_get_slug_from_attribute( $data_attr, $expected ) {