From 5f9e32d8ccc8240b7abd6ee59a8dec3baff6e0cc Mon Sep 17 00:00:00 2001 From: Paul Bearne Date: Fri, 19 Jan 2024 15:44:49 -0500 Subject: [PATCH 1/3] Add tests for wp_staticize_emoji_for_email function A new unit test for the wp_staticize_emoji_for_email function has been added. This test provides verification for a variety of scenarios; from simple messages, messages with emojis, and adjustments based on the email's content type. --- .../formatting/printEmojiDetectionScript.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/phpunit/tests/formatting/printEmojiDetectionScript.php diff --git a/tests/phpunit/tests/formatting/printEmojiDetectionScript.php b/tests/phpunit/tests/formatting/printEmojiDetectionScript.php new file mode 100644 index 0000000000000..be33339fb1787 --- /dev/null +++ b/tests/phpunit/tests/formatting/printEmojiDetectionScript.php @@ -0,0 +1,25 @@ +assertStringContainsString( wp_json_encode( $png_cdn ), $output ); + + $this->assertEmpty( get_echo( 'print_emoji_detection_script' ) ); + } +} From f33ce9fb53cf7f74cda0c8811960a3b79dc654cb Mon Sep 17 00:00:00 2001 From: Paul Bearne Date: Fri, 19 Jan 2024 17:58:18 -0500 Subject: [PATCH 2/3] Add tests for wp_enqueue_emoji_styles function Two new unit tests have been added for the wp_enqueue_emoji_styles function. Both tests provide different scenarios - one checks if the expected styles are included in wp_print_styles, and the other tests the non-inclusion after the print_emoji_styles action has been removed. --- .../tests/formatting/wpEnqueueEmojiStyles.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/phpunit/tests/formatting/wpEnqueueEmojiStyles.php diff --git a/tests/phpunit/tests/formatting/wpEnqueueEmojiStyles.php b/tests/phpunit/tests/formatting/wpEnqueueEmojiStyles.php new file mode 100644 index 0000000000000..90a8a57060a58 --- /dev/null +++ b/tests/phpunit/tests/formatting/wpEnqueueEmojiStyles.php @@ -0,0 +1,29 @@ +assertStringContainsString( 'img.wp-smiley, img.emoji', get_echo( 'wp_print_styles' ) ); + } + + /** + * @ticket 60306 + */ + public function test_wp_enqueue_emoji_styles_done() { + remove_action( 'wp_print_styles', 'print_emoji_styles' ); + + wp_enqueue_emoji_styles(); + $this->assertStringNotContainsString( 'img.wp-smiley, img.emoji', get_echo( 'wp_print_styles' ) ); + } +} From e891acb109bff741498ea27761c614378a646167 Mon Sep 17 00:00:00 2001 From: Paul Bearne Date: Fri, 19 Jan 2024 18:02:30 -0500 Subject: [PATCH 3/3] Revert "Add tests for wp_enqueue_emoji_styles function" This reverts commit f33ce9fb53cf7f74cda0c8811960a3b79dc654cb. --- .../tests/formatting/wpEnqueueEmojiStyles.php | 29 ------------------- 1 file changed, 29 deletions(-) delete mode 100644 tests/phpunit/tests/formatting/wpEnqueueEmojiStyles.php diff --git a/tests/phpunit/tests/formatting/wpEnqueueEmojiStyles.php b/tests/phpunit/tests/formatting/wpEnqueueEmojiStyles.php deleted file mode 100644 index 90a8a57060a58..0000000000000 --- a/tests/phpunit/tests/formatting/wpEnqueueEmojiStyles.php +++ /dev/null @@ -1,29 +0,0 @@ -assertStringContainsString( 'img.wp-smiley, img.emoji', get_echo( 'wp_print_styles' ) ); - } - - /** - * @ticket 60306 - */ - public function test_wp_enqueue_emoji_styles_done() { - remove_action( 'wp_print_styles', 'print_emoji_styles' ); - - wp_enqueue_emoji_styles(); - $this->assertStringNotContainsString( 'img.wp-smiley, img.emoji', get_echo( 'wp_print_styles' ) ); - } -}