From 5b248c08e6228422f4aefd6bceab5c724c6841f7 Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Mon, 2 Jan 2023 15:58:57 +0100 Subject: [PATCH] Verify that get_attribute_names finds attribute added by set_attribute --- phpunit/html/wp-html-tag-processor-test.php | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/phpunit/html/wp-html-tag-processor-test.php b/phpunit/html/wp-html-tag-processor-test.php index eddfc68fbe8453..56b7f312971cf5 100644 --- a/phpunit/html/wp-html-tag-processor-test.php +++ b/phpunit/html/wp-html-tag-processor-test.php @@ -266,6 +266,29 @@ public function test_get_attribute_names_returns_attribute_names() { ); } + /** + * @ticket 56299 + * + * @covers set_attribute + * @covers get_updated_html + * @covers get_attribute_names + */ + public function test_get_attribute_names_returns_attribute_added_by_set_attribute() { + $p = new WP_HTML_Tag_Processor( '
Test
' ); + $p->next_tag(); + $p->set_attribute( 'test-attribute', 'test-value' ); + $this->assertSame( + '
Test
', + $p->get_updated_html(), + "Updated HTML doesn't include attribute added via set_attribute" + ); + $this->assertSame( + array( 'test-attribute', 'class' ), + $p->get_attribute_names(), + "Accessing attribute names doesn't find attribute added via set_attribute" + ); + } + /** * @ticket 56299 *