From 4295e308577153ca8642930382efbd95f7b0c2d8 Mon Sep 17 00:00:00 2001 From: Muhibul Haque Date: Fri, 6 Nov 2026 21:50:01 +0600 Subject: [PATCH 1/2] Tests: Cover wptexturize_primes(). See #65819. Props devmuhib009. --- .../tests/formatting/wptexturizePrimes.php | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 tests/phpunit/tests/formatting/wptexturizePrimes.php diff --git a/tests/phpunit/tests/formatting/wptexturizePrimes.php b/tests/phpunit/tests/formatting/wptexturizePrimes.php new file mode 100644 index 0000000000000..7cbdbfd1e032c --- /dev/null +++ b/tests/phpunit/tests/formatting/wptexturizePrimes.php @@ -0,0 +1,86 @@ +assertSame( $expected, wptexturize_primes( $input, "'", $prime, $open_quote, $close_quote ) ); + } + + /** + * Tests double prime replacement for double quotes after numbers. + * + * @ticket 65819 + */ + public function test_wptexturize_primes_double_quote() { + $prime = '″'; + $open_quote = '“'; + $close_quote = '”'; + + $input = 'A 12" record.'; + $expected = "A 12{$prime} record."; + + $this->assertSame( $expected, wptexturize_primes( $input, '"', $prime, $open_quote, $close_quote ) ); + } + + /** + * Tests that text without the needle character is returned unchanged. + * + * @ticket 65819 + */ + public function test_wptexturize_primes_without_matching_needle() { + $text = 'Text without any quotes at all.'; + + $this->assertSame( $text, wptexturize_primes( $text, "'", '′', '‘', '’' ) ); + } + + /** + * Tests closing quote disambiguation when numbers with primes are inside quotations. + * + * @ticket 65819 + */ + public function test_wptexturize_primes_inside_quotations() { + $prime = '′'; + $open_quote = '‘'; + $close_quote = '’'; + + $input = "{$open_quote}I am 6' tall.'"; + $expected = "{$open_quote}I am 6{$prime} tall.{$close_quote}"; + + $this->assertSame( $expected, wptexturize_primes( $input, "'", $prime, $open_quote, $close_quote ) ); + } + + /** + * Tests that quotes not preceded by numbers become closing quotes. + * + * @ticket 65819 + */ + public function test_wptexturize_primes_normal_quotes_become_closing_quotes() { + $prime = '″'; + $open_quote = '“'; + $close_quote = '”'; + + $input = 'A "quoted word".'; + $expected = "A {$close_quote}quoted word{$close_quote}."; + + $this->assertSame( $expected, wptexturize_primes( $input, '"', $prime, $open_quote, $close_quote ) ); + } +} From 529837f8ce638c798a318baf7f5963c5b013c219 Mon Sep 17 00:00:00 2001 From: Muhibul Haque Date: Sat, 7 Nov 2026 20:33:52 +0600 Subject: [PATCH 2/2] Tests: Cover wptexturize_primes(). See #66609. Props devmuhib009. --- tests/phpunit/tests/formatting/wptexturizePrimes.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/phpunit/tests/formatting/wptexturizePrimes.php b/tests/phpunit/tests/formatting/wptexturizePrimes.php index 7cbdbfd1e032c..ec4954d2c77a4 100644 --- a/tests/phpunit/tests/formatting/wptexturizePrimes.php +++ b/tests/phpunit/tests/formatting/wptexturizePrimes.php @@ -12,7 +12,7 @@ class Tests_Formatting_WptexturizePrimes extends WP_UnitTestCase { /** * Tests prime replacement for single quotes after numbers. * - * @ticket 65819 + * @ticket 66609 */ public function test_wptexturize_primes_single_quote() { $prime = '′'; @@ -28,7 +28,7 @@ public function test_wptexturize_primes_single_quote() { /** * Tests double prime replacement for double quotes after numbers. * - * @ticket 65819 + * @ticket 66609 */ public function test_wptexturize_primes_double_quote() { $prime = '″'; @@ -44,7 +44,7 @@ public function test_wptexturize_primes_double_quote() { /** * Tests that text without the needle character is returned unchanged. * - * @ticket 65819 + * @ticket 66609 */ public function test_wptexturize_primes_without_matching_needle() { $text = 'Text without any quotes at all.'; @@ -55,7 +55,7 @@ public function test_wptexturize_primes_without_matching_needle() { /** * Tests closing quote disambiguation when numbers with primes are inside quotations. * - * @ticket 65819 + * @ticket 66609 */ public function test_wptexturize_primes_inside_quotations() { $prime = '′'; @@ -71,7 +71,7 @@ public function test_wptexturize_primes_inside_quotations() { /** * Tests that quotes not preceded by numbers become closing quotes. * - * @ticket 65819 + * @ticket 66609 */ public function test_wptexturize_primes_normal_quotes_become_closing_quotes() { $prime = '″';