Skip to content

Commit

Permalink
Add test for get_attribute() when in closing tag
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Jan 2, 2023
1 parent 8be4ac9 commit 8c51859
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions phpunit/html/wp-html-tag-processor-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,19 @@ public function test_get_attribute_returns_null_when_not_in_open_tag() {
$this->assertNull( $p->get_attribute( 'class' ), 'Accessing an attribute of a non-existing tag did not return null' );
}

/**
* @ticket 56299
*
* @covers next_tag
* @covers get_attribute
*/
public function test_get_attribute_returns_null_when_in_closing_tag() {
$p = new WP_HTML_Tag_Processor( '<div class="test">Test</div>' );
$this->assertTrue( $p->next_tag( 'div' ), 'Querying an existing tag did not return true' );
$this->assertTrue( $p->next_tag( array( 'tag_closers' => 'visit' ) ), 'Querying an existing closing tag did not return true' );
$this->assertNull( $p->get_attribute( 'class' ), 'Accessing an attribute of a closing tag did not return null' );
}

/**
* @ticket 56299
*
Expand Down

0 comments on commit 8c51859

Please sign in to comment.