-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic unit test coverage for has_bookmark
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
phpunit/html-api/class-gutenberg-html-tag-processor-6-3-test.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* Unit tests covering Gutenberg_HTML_Tag_Processor_6_3 functionality. | ||
* | ||
* @package WordPress | ||
* @subpackage HTML | ||
*/ | ||
|
||
require_once __DIR__ . '/../../lib/compat/wordpress-6.3/html-api/class-gutenberg-html-tag-processor-6-3.php'; | ||
|
||
/** | ||
* @group html-api | ||
* | ||
* @coversDefaultClass Gutenberg_HTML_Tag_Processor_6_3 | ||
*/ | ||
class Gutenberg_HTML_Tag_Processor_6_3_Test extends WP_UnitTestCase { | ||
/** | ||
* @covers has_bookmark | ||
*/ | ||
public function test_has_bookmark_returns_false_if_bookmark_does_not_exist() { | ||
$p = new Gutenberg_HTML_Tag_Processor_6_3( '<div>Test</div>' ); | ||
$this->assertFalse( $p->has_bookmark( 'my-bookmark' ) ); | ||
} | ||
|
||
/** | ||
* @covers has_bookmark | ||
*/ | ||
public function test_has_bookmark_returns_true_if_bookmark_exists() { | ||
$p = new Gutenberg_HTML_Tag_Processor_6_3( '<div>Test</div>' ); | ||
$p->next_tag(); | ||
$p->set_bookmark( 'my-bookmark' ); | ||
$this->assertTrue( $p->has_bookmark( 'my-bookmark' ) ); | ||
} | ||
|
||
/** | ||
* @covers has_bookmark | ||
*/ | ||
public function test_has_bookmark_returns_false_if_bookmark_has_been_released() { | ||
$p = new Gutenberg_HTML_Tag_Processor_6_3( '<div>Test</div>' ); | ||
$p->next_tag(); | ||
$p->set_bookmark( 'my-bookmark' ); | ||
$p->release_bookmark( 'my-bookmark' ); | ||
$this->assertFalse( $p->has_bookmark( 'my-bookmark' ) ); | ||
} | ||
} |