From eb4fa58ea894cec1e8d6c67236b0a884d5379999 Mon Sep 17 00:00:00 2001 From: shail-mehta Date: Tue, 3 Nov 2026 17:01:03 +0000 Subject: [PATCH] Tests: Add unit coverage for `get_term_to_edit()`. Cover edit-context sanitization via the edit_term_name filter. See #65819. --- tests/phpunit/tests/term/getTermToEdit.php | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/phpunit/tests/term/getTermToEdit.php diff --git a/tests/phpunit/tests/term/getTermToEdit.php b/tests/phpunit/tests/term/getTermToEdit.php new file mode 100644 index 0000000000000..c8a5c9655b75f --- /dev/null +++ b/tests/phpunit/tests/term/getTermToEdit.php @@ -0,0 +1,33 @@ +category->create( + array( + 'name' => 'News', + ) + ); + + add_filter( + 'edit_term_name', + static function ( $value ) { + return $value . '|edit'; + } + ); + + $term = get_term_to_edit( $term_id, 'category' ); + + $this->assertInstanceOf( 'WP_Term', $term ); + $this->assertSame( 'News|edit', $term->name ); + } +}