Skip to content

Commit f960d1e

Browse files
committed
Add basic unit test coverage for has_bookmark
1 parent bce5b31 commit f960d1e

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Unit tests covering Gutenberg_HTML_Tag_Processor_6_3 functionality.
4+
*
5+
* @package WordPress
6+
* @subpackage HTML
7+
*/
8+
9+
require_once __DIR__ . '/../../lib/compat/wordpress-6.3/html-api/class-gutenberg-html-tag-processor-6-3.php';
10+
11+
/**
12+
* @group html-api
13+
*
14+
* @coversDefaultClass Gutenberg_HTML_Tag_Processor_6_3
15+
*/
16+
class Gutenberg_HTML_Tag_Processor_6_3_Test extends WP_UnitTestCase {
17+
/**
18+
* @covers has_bookmark
19+
*/
20+
public function test_has_bookmark_returns_false_if_bookmark_does_not_exist() {
21+
$p = new Gutenberg_HTML_Tag_Processor_6_3( '<div>Test</div>' );
22+
$this->assertFalse( $p->has_bookmark( 'my-bookmark' ) );
23+
}
24+
25+
/**
26+
* @covers has_bookmark
27+
*/
28+
public function test_has_bookmark_returns_true_if_bookmark_exists() {
29+
$p = new Gutenberg_HTML_Tag_Processor_6_3( '<div>Test</div>' );
30+
$p->next_tag();
31+
$p->set_bookmark( 'my-bookmark' );
32+
$this->assertTrue( $p->has_bookmark( 'my-bookmark' ) );
33+
}
34+
35+
/**
36+
* @covers has_bookmark
37+
*/
38+
public function test_has_bookmark_returns_false_if_bookmark_has_been_released() {
39+
$p = new Gutenberg_HTML_Tag_Processor_6_3( '<div>Test</div>' );
40+
$p->next_tag();
41+
$p->set_bookmark( 'my-bookmark' );
42+
$p->release_bookmark( 'my-bookmark' );
43+
$this->assertFalse( $p->has_bookmark( 'my-bookmark' ) );
44+
}
45+
}

0 commit comments

Comments
 (0)