Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Feb 22, 2023
1 parent c8823c7 commit 8f43d6e
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/phpunit/tests/html-api/wpHtmlTagProcessor-bookmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,41 @@ public function test_release_bookmark() {
$this->assertTrue( $p->release_bookmark( 'first li' ), 'Could not release a bookmark' );
}

/**
* @ticket 57788
*
* @covers WP_HTML_Tag_Processor::has_bookmark
*/
public function test_has_bookmark_returns_false_if_bookmark_does_not_exist() {
$p = new WP_HTML_Tag_Processor( '<div>Test</div>' );
$this->assertFalse( $p->has_bookmark( 'my-bookmark' ) );
}

/**
* @ticket 57788
*
* @covers WP_HTML_Tag_Processor::has_bookmark
*/
public function test_has_bookmark_returns_true_if_bookmark_exists() {
$p = new WP_HTML_Tag_Processor( '<div>Test</div>' );
$p->next_tag();
$p->set_bookmark( 'my-bookmark' );
$this->assertTrue( $p->has_bookmark( 'my-bookmark' ) );
}

/**
* @ticket 57788
*
* @covers WP_HTML_Tag_Processor::has_bookmark
*/
public function test_has_bookmark_returns_false_if_bookmark_has_been_released() {
$p = new WP_HTML_Tag_Processor( '<div>Test</div>' );
$p->next_tag();
$p->set_bookmark( 'my-bookmark' );
$p->release_bookmark( 'my-bookmark' );
$this->assertFalse( $p->has_bookmark( 'my-bookmark' ) );
}

/**
* @ticket 56299
*
Expand Down

0 comments on commit 8f43d6e

Please sign in to comment.