Skip to content

Commit

Permalink
Or maybe just extend the existing test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Jan 4, 2023
1 parent 87566df commit 9ccc918
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions phpunit/html/wp-html-tag-processor-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,30 +417,19 @@ public function data_set_attribute_escapable_values() {
);
}

/**
* @covers get_attribute
* @covers set_attribute
* @covers get_updated_html
*/
public function test_get_attribute_finds_attribute_added_by_set_attribute() {
$p = new WP_HTML_Tag_Processor( self::HTML_SIMPLE );
$p->next_tag();
$p->set_attribute( 'test-attribute', 'test-value' );
$this->assertSame( '<div test-attribute="test-value" id="first"><span id="second">Text</span></div>', $p->get_updated_html() );
$this->assertSame( 'test-value', $p->get_attribute( 'test-attribute' ) );
}

/**
* @ticket 56299
*
* @covers set_attribute
* @covers get_updated_html
* @covers get_attribute
*/
public function test_set_attribute_with_a_non_existing_attribute_adds_a_new_attribute_to_the_markup() {
$p = new WP_HTML_Tag_Processor( self::HTML_SIMPLE );
$p->next_tag();
$p->set_attribute( 'test-attribute', 'test-value' );
$this->assertSame( '<div test-attribute="test-value" id="first"><span id="second">Text</span></div>', $p->get_updated_html() );
$this->assertSame( 'test-value', $p->get_attribute( 'test-attribute' ) );
}

/**
Expand Down

0 comments on commit 9ccc918

Please sign in to comment.