From 56ac42c94c15d39c18b30c168028a7c3689504c9 Mon Sep 17 00:00:00 2001 From: rejaulalomkhan Date: Tue, 24 Nov 2026 09:43:55 +0600 Subject: [PATCH 1/2] Tests: Add unit tests for wp_theme_get_element_class_name(). Cover known elements ('button', 'caption'), non-registered elements, empty string, and unknown elements. See #56467. --- .../theme/wpThemeGetElementClassName.php | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/phpunit/tests/theme/wpThemeGetElementClassName.php diff --git a/tests/phpunit/tests/theme/wpThemeGetElementClassName.php b/tests/phpunit/tests/theme/wpThemeGetElementClassName.php new file mode 100644 index 0000000000000..9fe781e86be7e --- /dev/null +++ b/tests/phpunit/tests/theme/wpThemeGetElementClassName.php @@ -0,0 +1,41 @@ +assertSame( $expected, $actual, "Class name for element '{$element}' should match expected value." ); + } + + /** + * Data provider for test_wp_theme_get_element_class_name. + * + * @return array + */ + public static function data_elements_and_class_names() { + return array( + 'button element' => array( 'button', 'wp-element-button' ), + 'caption element' => array( 'caption', 'wp-element-caption' ), + 'non-registered element' => array( 'heading', '' ), + 'empty element string' => array( '', '' ), + 'unknown custom element' => array( 'unknown_element', '' ), + ); + } +} From 7a989bece29a57cffd7b7f7876af1b5218478172 Mon Sep 17 00:00:00 2001 From: rejaulalomkhan Date: Tue, 24 Nov 2026 17:52:57 +0600 Subject: [PATCH 2/2] Tests: Update group and ticket annotations in wpThemeGetElementClassName. --- tests/phpunit/tests/theme/wpThemeGetElementClassName.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/theme/wpThemeGetElementClassName.php b/tests/phpunit/tests/theme/wpThemeGetElementClassName.php index 9fe781e86be7e..84537a9637bf1 100644 --- a/tests/phpunit/tests/theme/wpThemeGetElementClassName.php +++ b/tests/phpunit/tests/theme/wpThemeGetElementClassName.php @@ -2,7 +2,7 @@ /** * Test wp_theme_get_element_class_name(). * - * @group theme + * @group themes * * @covers ::wp_theme_get_element_class_name */ @@ -11,7 +11,7 @@ class Tests_Theme_WpThemeGetElementClassName extends WP_UnitTestCase { /** * Tests that wp_theme_get_element_class_name() returns correct class name for known and unknown elements. * - * @ticket 56467 + * @ticket 65819 * * @dataProvider data_elements_and_class_names *